abpBrainExtraction.Rd
Brain extraction based on mapping a template image and its mask to the input image. Should be preceded by abpN4.
abpBrainExtraction( img, tem, temmask, temregmask = NULL, regtype = "SyN", tdir = NA, num_threads = 1, pad = 0, verbose = FALSE )
img | whole head image to which we map a brain mask |
---|---|
tem | Template image (the whole head) which has an associated label mask. |
temmask | Template's antsImage brain mask. |
temregmask | Template's registration mask including skull but not the face |
regtype | registration type: 'SyN' (fast, default), 'SyNabp' (better, slower) |
tdir | temporary directory (optional) |
num_threads | will execute
|
pad | argument passed to |
verbose | print diagnostic messages |
outputs a brain image and brain mask.
Tustison N, Avants BB
Sys.setenv(ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS = 1) set.seed(1) n = 64 fn<-getANTsRData("r16") img<-antsImageRead(fn) img<-resampleImage(img,c(n,n),1,0) tf<-getANTsRData("r27") tem<-antsImageRead(tf) tem<-resampleImage(tem,c(n,n),1,0) temmask<-antsImageClone( tem ) temmask[ tem > 20 ] <- 1 temmask[ tem <= 20 ] <- 0 bm<-ANTsR::abpBrainExtraction(img=img,tem=tem,temmask=temmask, num_threads = 1) stopifnot(sum(bm$bmask) != prod(dim(bm$brain))) bm2<-ANTsR::abpBrainExtraction(img=img,tem=tem,temmask=temmask, num_threads = 1) stopifnot(sum(bm2$bmask) != prod(dim(bm2$brain)))