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
)

Arguments

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 Sys.setenv(ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS = num_threads) before running to attempt a more reproducible result. See https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues for discussion. If NULL, will not set anything.

pad

argument passed to iMath for how much to zero-pad the image

verbose

print diagnostic messages

Value

outputs a brain image and brain mask.

Author

Tustison N, Avants BB

Examples

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
if (FALSE) { # \dontrun{
bm <- abpBrainExtraction(img = img, tem = tem, temmask = temmask)
} # }