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
)
whole head image to which we map a brain mask
Template image (the whole head) which has an associated label mask.
Template's antsImage brain mask.
Template's registration mask including skull but not the face
registration type: 'SyN' (fast, default), 'SyNabp' (better, slower)
temporary directory (optional)
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.
argument passed to iMath
for how much to
zero-pad the image
print diagnostic messages
outputs a brain image and brain mask.
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)
} # }