Residualizes the images in files to the model form and writes the output to outfiles optionally smoothes with sm (in mm FWHM) using susan prior to residualizing if smoutfiles is specified smoothed images are saved into that directory. Used to run simulations to assess power and type 1 error for papers. This creates images that are residualized to the covariates which can then be bootstrapped to generate a sample where there is the potential for heteroskedasticity/nonexchangeability, but where the covariates are unassociated with the mean of the outcome.

residualizeImages(files, form, dat, mask, outfiles, smoutfiles = NULL,
  sm = 0, mc.cores = getOption("mc.cores", 2L))

Arguments

files

Character vector of subject images to be modeled as an outcome variable.

form

mgcv or lm style formula.

dat

Data frame containing covariates used by form.

mask

Character giving location of mask image.

outfiles

Character vector of residual output images to smooth.

smoutfiles

Character vector of smoothed output images.

sm

Numeric giving the smoothing amount in mm FWHM to perform before creating residuals. Smoothing is performed using fsl's susan.

mc.cores

Argument passed to mclapply for parallel things.

Value

No returned value. This functions saves out nifti images files after residualizing to the model specified by form and dat. The residuals of files are saved as the corresponding element in outfiles.