340 likes | 795 Views
AFNI: Analysis of Functional NeuroImages. Andrew Jahn IUNG April 9 th , 2012. The AFNI Team. Ziad Saad (SUMA creator). Bob Cox (Hive Mind). Gang Chen (Statistics Expert). Rick Reynolds (Python Developer). Daniel Glen ( Coregistration ). AFNI fans !.
E N D
AFNI: Analysis of Functional NeuroImages Andrew Jahn IUNG April 9th, 2012
The AFNI Team ZiadSaad (SUMA creator) Bob Cox (Hive Mind) Gang Chen (Statistics Expert) Rick Reynolds (Python Developer) Daniel Glen (Coregistration) AFNI fans!
Outline • Overview of AFNI • Interesting new tools • Future Directions / Workshops / Resources
What is AFNI? • Analysis of Functional NeuroImages • Just another fMRI analysis package • Similar to SPM, FSL, Brainvoyager, etc. • HOWEVER: Excels at helping the user visualize data at each step • Cool (and maybe even useful) tools for surface-based analysis
What is AFNI? • Advantages: • Allows for flexible scripting (very little “black-box” throughout analysis) • Very fast compared to, say, SPM • Built-in toolboxes for functional connectivity (cf. InstaCorr, IM modulation) and MVPA (1dsvm) • Disadvantages: • Requires knowledge of Unix interface • Very script heavy • Advantages in speed come with tradeoff – many hours of debugging when getting started
Ye good olde days • Script everything • Cobble together customized script for each subject • The good: Hyper-customized • The bad: Nobody else can figure out what you are doing • The ugly: Assumes that you know what you are doing Decadent modern times • Streamline analysis with python scripts (cf. afni_proc.py) • Recent technological breakthrough: Include GUI (!) for preprocessing (cf. uber_subject.py) • Makes it easier for user and for tech support to troubleshoot problems
Afni data format / Jargon • BRIK/HEAD files • E.g., run_01+orig.BRIK, run_01+orig.HEAD • Same idea as *.hdr, *.img format of ANALYZE • Can easily convert to and from NIFTI (e.g., 3dcopy, 3dAFNItoNIFTI) • Rounding errors -> can save in float (as opposed to short) data type • N.B.: Mixing data types is NOT a good idea!! • Interchangeable with different steps of other processing streams • For example: Write AFNI wrapper to perform preprocessing, do GLMs with SPM • Can also convert Brainvoyagervmr/fmr to .BRIK/.HEAD using 3dBRAINVOYAGERtoAFNI • Still being tested!
Key aspects of afni • Extremely ‘hands-on’ • i.e., will tell you everything it is doing (and I mean everything) • Output can be controlled through -verbose options • Important for debugging • Flexibility with GLMs • For example: Can model data with customized basis function built in FLOBS (or Matlab) • Can model different classes with different basis functions
AFNI-Specific Tools • 3dREML • 3dMEMA • SUMA
3dREML • Restricted Maximum Likelihood • Takes into account variability in Beta estimates at individual level • Weights betas according to variance • Account for serial correlation between time points (i.e., lower number of independent TRs -> lower degrees of freedom) • 3dMEMA • Mixed Effects Meta-Analysis • Incorporates information about individual estimates in beta at 2nd-level (i.e., uses info about the beta and the t-statistic associated with that beta) • Recommended way to analyze results using AFNI
Example: Study where subjects either generate one prediction (pred1) or two predictions (pred2) about potential outcomes • Weighting each subject equally: peak voxel t-statistic of 7.01 for group-level contrast pred2-pred1 (generated using SPM)
Results of 3dMEMA: Peak voxel t-statistic of 6.02 (and in location anterior to that generated by SPM) • Which is correct? Experimenter must decide
SUMA • Surface Mapper • Sister program to AFNI • Can map volumetric data onto surface maps, and vice versa • Can use much larger smoothing kernels (e.g., 10-20mm; larger values possible but ridiculous) • Pros: SNR increases (in theory) • Avoids the problem of smoothing across crowns of gyri • Visualization of activation within sulci / around banks of gyri • ROI drawing on surface
6mm 20mm Conclusion: Larger smoothing kernels marginally increase statistical values at the loss of some spatial specificity 15mm
SUMA • Best method: Go through process of mapping each individual’s volumetric data onto individual surface • Preprocess and run stats on surface • Take results to group level • However, can be used to map volumetric group-level activation already processed in another package (such as SPM) onto template surface • Step 1: Accept geometric limitations of this approach • Step 2: Go ahead and make sexy figures anyway
Example: Experiment where participant imagines error versus imagines correct feedback (ImagineError-ImagineCorrect) • Processed in SPM • In our paper, we claimed that we observed activation in the superior frontal sulcus • But did we??? • Maps converted to AFNI format, splashed onto template SUMA surface
3dInstaCorr • AFNI’s latest tool allowing for real-time functional connectivity analysis • Recommended for use with resting state data • Theory: Regress out motion, physiological covariates (heart rate, respiration, etc) and model the rest (i.e., what is usually called “noise”) • See which timecourses in which voxels are significantly correlated • For use with, e.g., clinical populations vs. controls
Tools in the Trunk • 3dClustSim – Replacement of AlphaSim • More reliable for smoothing less than 10mm (as opposed to Gaussian Random Field theory) • Calculate multiple p-thresholds simultaneously • Automatically incorporated into processing pipeline to determine significance of clusters / updates instantly when p-threshold changes • 3dMaskDump / 3dUndump • Extract parameter estimates from mask / create mask in given location
Tools in the Trunk • 3dBlurInMask • Smooth only within grey matter (defined by mask generated by FreeSurfer, for example) • However, can lead to weird biases at 2nd level, as grey matter masks are more stereotyped per subject than normalized anatomical mask • Alternatives: • Smooth over average of all subjects’ GM masks • Smooth over whole brain mask (GM + WM) • Still to be tested
Tools in the Trunk • 3dDespike • Used for “squashing” outlying data values • Especially useful for uncooperative scanners / populations that move a lot (e.g., children) • Is a standard part of preprocessing in our lab
Tools in the Trunk • FreeSurfer • Used for generating surface maps to then be used with AFNI • However, also generates useful auxiliary data • E.g., tables of volume for each grey and white matter structure • Can be used as covariates, possibly with patient populations
Tools in the Trunk • Scripts for interfacing with Quarry, IU’s supercomputer cluster • Developed for Dr. RuchikaPrakash at OSU, 2010 • Needed a way to processing 100+ anatomical scans through FreeSurfer • Each FreeSurfer image takes 20-30 hours to process • With Quarry, number of subjects is not an issue: everything gets done within 20-30 hours • Can save time by orders of magnitude • Scripts available for download at: http://mypage.iu.edu/~ajahn/docs/Supercomputer_Scripts.zip
Resources • AFNI Message Board • Typically respond to questions on the order of minutes • Implement changes within a few days, sometimes a few hours • AFNI users are beta-testers for life
Resources • Links: • AFNI: http://afni.nimh.nih.gov/ • FreeSurfer: http://surfer.nmr.mgh.harvard.edu/fswiki • My Webpage: http://mypage.iu.edu/~ajahn/ • Contains links and programs that may be useful • If you use my programs I am not responsible for anything that happens, ever. • Screencasts: http://www.screencast.com/users/Andrew.Jahn • First developed back in ye good olde days at OSU to help apathetic, shiftless undergraduates learn Unix - may create more if there is demand
Future Directions • Workshops • Several students have expressed interest in an FSL workshop • May also include AFNI at some point • This summer? Next fall? Suggestions? • Other • More documentation and screencasts will be available soon • Desideratum: Apply Bayesian inference at voxel level for parameter estimates (e.g., have AFNI interface with JAGS, restrict analysis to grey matter mask) • Possible, but difficult to implement and takes a ridiculously long time (cf. FSL’s FLAME 1+2) • Experiment with AFNI’s real-time volume registration during scanning using the program Dimon (developed by Rick Reynolds)
Acknowledgements • Josh Brown • The AFNI group • Adrian Lange, Argonne National Laboratory
Key aspects of afni • Example of flexible GLMs: • Assume we have 3 classes of stimuli (positive, negative, neutral). We think that: • Negative will follow canonical 1-parameter gamma response (GAM) • Positive will not have fixed BOLD profile and therefore be data-driven (TENT, similar to SPM’s FIR basis function) • Neutral will follow block response of 30s duration (BLOCK) • Give yourself a point if you understood everything in caps • afni_proc.py -dsetsdatasets+orig.HEAD -regress_stim_times sb23/stim_files/blk_times.*.1D \ • -regress_stim_times sb23/stim_files/blk_times.*.1D \ -regress_stim_labelstnegtpostneu \eneg epos eneu \fnegfposfneu \ -regress_basis_multi \‘GAM' 'TENT(0,45,16)' 'BLOCK(30,1)' \ ’GAM’ 'TENT(0,45,16)' 'BLOCK(30,1)' \ ‘GAM' 'TENT(0,45,16)' 'BLOCK(30,1)' \