getASLNoisePredictors.RdGet nuisance predictors from ASL images
getASLNoisePredictors(
  aslmat,
  tc,
  noisefrac = 0.1,
  polydegree = "loess",
  k = 5,
  npreds = 12,
  method = "noisepool",
  covariates = NA,
  noisepoolfun = max
)ASL input matrix.
Tag-control sawtooth pattern vector.
Fraction of data to include in noise pool.
Degree of polynomial for detrending, with a value of 0
indicating no detrending, or 'loess' for LOESS-based estimation of
global time-series trends.
Number of cross-validation folds.
Number of predictors to output.
Method of selecting noisy voxels.  One of 'compcor' or
'noisepool'. See Details.
Covariates to be considered when assessing prediction of tc pattern.
Function used for aggregating R^2 values.
Matrix of size nrow(aslmat) by npreds, containing a
  timeseries of all the nuisance predictors.
# 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)
}