Preprocess fMRI data which includes compcor/motion correction, nuisance regression, band-pass filtering, and spatial smoothing.
antsPreprocessfMRI <- function( boldImage,
maskImage = NA,
maskingThreshold = 0.75,
initialNuisanceVariables = NA,
numberOfCompCorComponents = 6,
doMotionCorrection = TRUE,
useMotionCorrectedImage = FALSE,
motionCorrectionAccuracyLevel = 1,
meanBoldFixedImageForMotionCorrection = NA,
spatialSmoothingType = c( "none", "gaussian", "perona-malik" ),
spatialSmoothingParameters = 0.0,
frequencyLowThreshold = 0.01,
frequencyHighThreshold = 0.1 )
4-D ANTs image fMRI data.
Optional target fixed image for motion correction.
3-D ANTs image defining the region of interest.
If mask image is not specified, a mask image is created using the specified threshold which is in terms of the mean of the average image ie 0.8 means threshold at 0.8 of the mean.
Optional initial nuisance variables.
Numer of CompCor nuisance components.
Booelan indicating whether motion correction should be performed and used in nuisance regression.
Boolean indicating whether or not the motion corrected image should be used in the rest of the pipeline. This is off by default to avoid additional interpolation.
Accuracy for the motion correcting registration: 0 = fast/debug parameters, 1 = intrasession parameters, or 2 = intersession/intersubject parameters.
Lower threshold for bandpass filtering.
Upper threshold for bandpass filtering.
Either "none", "gaussian" (isotropic) or "perona-malik" (anisotropic) smoothing.
For gaussian smoothing, this is a single scalar designating the smoothing sigma (in mm). For perona-malik, a vector needs to be specified with the conductance parameter and the number of iterations, e.g. c( 0.25, 5 ).
Output is the "clean" fMRI bold image and mask. Quality assurance output includes the framewise displacement (FD) and DVARS. "DVARS is the root mean squared (RMS) change in BOLD signal from volume to volume (D referring to temporal derivative of time courses and VARS referring to RMS variance over voxels.)" --- Power et. al 2012, Spurious but systematic correlations in functional connectivity MRI networks arise from subject motion. Neuroimage 59, 2142-2154. The globalSignal is also returned.
# NOT RUN {
boldImage <- antsImageRead( "fmri.nii.gz", dim = 4, pixeltype = "float" )
cleanfMRI <- antsPreprocessfMRI( boldImage )
cleanBoldImage <- cleanfMRI$cleanBoldImage
maskImage <- cleanfMRI$maskImage
framewiseDisplacement <- cleanfMRI$FD
dtRMS <- cleanfMRI$DVARS
# }
Run the code above in your browser using DataLab