multivarTemplateCoordinates.Rmd
How to make a table and plot coordinates of a multivariate (soft) region of interest as produced by methods such as eigenanatomy.
First, load in a custom template paired with the output of a multivariate sparse decomposition or (alternatively) could be just a statistical map with zeroes in non-interesting areas.
library( ANTsR )
tem<-antsImageRead( getANTsRData("ch2") )
temlab2<-antsImageRead( getANTsRData("ch2a") )
temporalLobeRegions = thresholdImage( temlab2, 80, 90 ) %>%
smoothImage( 3 )
otherRegions = thresholdImage( temlab2, 20, 25 ) %>%
smoothImage( 1.5 )
This is the custom template and soft ROI pair.
mytem<-list( tem, temporalLobeRegions, otherRegions )
plot( tem, temporalLobeRegions,
window.overlay=c(0.1, max( temporalLobeRegions ) ) )
plot( tem, otherRegions, axis=3,
window.overlay=c(0.1, max( otherRegions ) ) )
plot( tem, otherRegions, axis=1,
window.overlay=c(0.1, max( otherRegions ) ) )
Gather the canonical template ( e.g. MNI space ).
mymni<-list( antsImageRead(getANTsRData("mni") ),
antsImageRead(getANTsRData("mnib") ),
antsImageRead(getANTsRData("mnia") ) )
Map to the canonical template.
mynetworkdescriptor<-getMultivariateTemplateCoordinates(
mytem, mymni , convertToTal = TRUE , pvals=c(0.01,0.05) )
Now look at the results in table form. This tells us where the (center of) the data is located in anatomical space and associates the known p-values with it. This is simulated data, so we already know the answers to this and these correspond to what we find here.
knitr::kable( mynetworkdescriptor$networks )
Enjoy.