Get nuisance predictors from ASL images

getASLNoisePredictors(
  aslmat,
  tc,
  noisefrac = 0.1,
  polydegree = "loess",
  k = 5,
  npreds = 12,
  method = "noisepool",
  covariates = NA,
  noisepoolfun = max
)

Arguments

aslmat

ASL input matrix.

tc

Tag-control sawtooth pattern vector.

noisefrac

Fraction of data to include in noise pool.

polydegree

Degree of polynomial for detrending, with a value of 0 indicating no detrending, or 'loess' for LOESS-based estimation of global time-series trends.

k

Number of cross-validation folds.

npreds

Number of predictors to output.

method

Method of selecting noisy voxels. One of 'compcor' or 'noisepool'. See Details.

covariates

Covariates to be considered when assessing prediction of tc pattern.

noisepoolfun

Function used for aggregating R^2 values.

Value

Matrix of size nrow(aslmat) by npreds, containing a timeseries of all the nuisance predictors.

Examples

# for real data do img<-antsImageRead(getANTsRData("pcasl"),4) set.seed(120) img<-makeImage( c(10,10,10,20), rnorm(1000*20)+1 ) mask = getMask( getAverageOfTimeSeries( img ) ) aslmat <- timeseries2matrix( img, mask ) tc <- rep(c(0.5, -0.5), length.out=nrow(aslmat)) noise <- getASLNoisePredictors(aslmat, tc, k=2, npreds=2, noisefrac=0.5 ) cm = colMeans(noise) rounding_type = RNGkind()[3] if (getRversion() < "3.6.0" || rounding_type == "Rounding") { testthat::expect_equal(cm, c(-0.223292128499263, 0.00434481670243642), tolerance = .01 ) } else { testthat::expect_equal(cm, c(-0.223377249912075, 0.0012754214030999), tolerance = .01) }