Description Usage Arguments Value Author(s) Examples
View source: R/initializeEigenanatomy.R
InitializeEigenanatomy is a helper function to initialize sparseDecom and sparseDecom2. Can be used to estimate sparseness parameters per eigenvector. The user then only chooses nvecs and optional regularization parameters.
| 1 | initializeEigenanatomy(initmat, mask = NULL, nreps = 1, smoothing = 0)
 | 
| initmat | input matrix where rows provide initial vector values. alternatively, this can be an antsImage which contains labeled regions. | 
| mask | mask if available | 
| nreps | nrepetitions to use | 
| smoothing | if using an initial label image, optionally smooth each roi | 
list is output
Avants BB
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | mat<-t(replicate(3, rnorm(100)) )
initdf<-initializeEigenanatomy( mat ) # produces a mask
dmat<-replicate(100, rnorm(20)) # data matrix
svdv = t( svd( mat, nu=0, nv=10 )$v )
ilist = matrixToImages( svdv, initdf$mask )
eseg = eigSeg( initdf$mask, ilist,  TRUE  )
eanat<-sparseDecom( dmat, inmask=initdf$mask,
 sparseness=0, smooth=0,
 initializationList=ilist, cthresh=0,
 nvecs=length(ilist) )
initdf2<-initializeEigenanatomy( mat, nreps=2 )
eanat<-sparseDecom( dmat, inmask=initdf$mask,
  sparseness=0, smooth=0, z=-0.5,
  initializationList=initdf2$initlist, cthresh=0,
  nvecs=length(initdf2$initlist) )
# now a regression
eanatMatrix<-eanat$eigenanatomyimages
# 'averages' loosely speaking anyway
myEigenanatomyRegionAverages<-dmat %*% t( eanatMatrix )
dependentvariable<-rnorm( nrow(dmat) )
summary(lm( dependentvariable ~ myEigenanatomyRegionAverages ))
nvox<-1000
dmat<-replicate(nvox, rnorm(20))
dmat2<-replicate(30, rnorm(20))
mat<-t(replicate(3, rnorm(nvox)) )
initdf<-initializeEigenanatomy( mat )
eanat<-sparseDecom2(
 inmatrix = list(dmat,dmat2), 
 inmask=list(initdf$mask,NA),
  sparseness=c( -0.1, -0.2 ), 
  smooth=0,
  initializationList=initdf$initlist, 
  cthresh=c(0,0),
  nvecs=length(initdf$initlist), priorWeight = 0.1 )
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.