Converts a set of multichannel images (e.g. deformation fields ) to a matrix to enable various forms of PCA. Returns the components of shape variability and variance explained. May employ different decomposition methods (WIP).

multichannelPCA(
  x,
  mask,
  k = NA,
  pcaOption = "PCA",
  auxiliaryModality,
  center = TRUE,
  sigma = NA,
  verbose = FALSE
)

Arguments

x

list containing multichannel images all of the same size

mask

mask to apply to the multichannel images

k

rank to use

pcaOption

currently only PCA and randPCA, latter being much faster. We also allow fastICA.

auxiliaryModality

if you pass this matrix, then will do CCA. This will only work with one option.

center

subtract the mean column vector.

sigma

parameter for kernel PCA.

verbose

produces more explanatory output.

Value

list of the pca output and conversion to multichannel images

Author

Avants BB

Examples


img1 <- antsImageRead(getANTsRData("r16")) %>%
  resampleImage(c(4, 4))
img2 <- antsImageRead(getANTsRData("r64")) %>%
  resampleImage(c(4, 4))
img3 <- antsImageRead(getANTsRData("r27")) %>%
  resampleImage(c(4, 4))
img4 <- antsImageRead(getANTsRData("r30")) %>%
  resampleImage(c(4, 4))
reg1 <- antsRegistration(img1, img2, "SyN")
reg2 <- antsRegistration(img1, img3, "SyN")
reg3 <- antsRegistration(img1, img4, "SyN")
w1 <- antsImageRead(reg1$fwdtransforms[1])
w2 <- antsImageRead(reg2$fwdtransforms[1])
w3 <- antsImageRead(reg3$fwdtransforms[1])
mask <- getMask(img1)
x <- list(w1, w2, w3)
dpca <- multichannelPCA(x, mask)
warpTx <- antsrTransformFromDisplacementField(dpca$pcaWarps[[1]])
warped <- applyAntsrTransform(warpTx, data = img1, reference = img1)