multichannelPCA.Rd
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
)
list containing multichannel images all of the same size
mask to apply to the multichannel images
rank to use
currently only PCA and randPCA, latter being much faster. We also allow fastICA.
if you pass this matrix, then will do CCA. This will only work with one option.
subtract the mean column vector.
parameter for kernel PCA.
produces more explanatory output.
list of the pca output and conversion to multichannel images
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)