In this tutorial we will discuss performing brain segmentation using:
FSL
(Jenkinson et al. 2012)
malf
command (method 3).extrantsr
, fslbet_robust
Let’s reset and read in the T1 image from a MS lesion data set:
library(neurobase) t1_fname = "training01_01_t1.nii.gz" t1 = neurobase::readnii(t1_fname) rt1 = robust_window(t1, probs = c(0, 0.975)); red0.5 = scales::alpha("red", 0.5) # for plotting later
ortho2(rt1)
Here we will use FSL’s Brain Extraction Tool (BET) to extract the brain tissue from the rest of the image (general overview):
fslr
- wraps FSL commands to use in R - registration, image manipulation
fslr::fslbet
- takes in a filename/nifti and calls FSL bet
function - additional options can be passed to FSL command in using opts
library(fslr) ss = fslbet(infile = t1_fname)
ortho2(robust_window(ss))
ortho2(rt1, ss > 0, col.y = red0.5)
Before doing skull-stripping/brain extraction, we would do bias correction:
library(extrantsr) bc_img = bias_correct(file = t1, correction = "N4")
bc_bet = fslbet(bc_img); ortho2(bc_img, bc_bet > 0, col.y = red0.5)
Figure from Multi-Atlas Skull Stripping method paper (Doshi et al. 2013):
extrantsr::malf
template.images
(T1-weighted images in this case) and template.structs
(labels/structures/masks, brain masks here)extrantsr::malf
function
SyN
) (Avants et al. 2008), a form of diffeomorphic registration:library(malf.templates) # load the data package library(extrantsr) timgs = mass_images(n_templates = 5) # let's register 5 templates ss = extrantsr::malf( infile = bc_img, template.images = timgs$images, template.structs = timgs$masks, keep_images = FALSE # don't keep the registered images ) mask = ss > 0
mask = readnii("training01_01_t1_mask.nii.gz") # already computed
ortho2(bc_img, mask, col.y = red0.5)
FSL BET did not work in the previous data set. It works in many cases, though. We will look at a subject from the kirby21 dataset (Landman et al. 2011).
library(kirby21.t1) t1_fname = get_t1_filenames()[1] t1 = readnii(t1_fname)
ortho2(robust_window(t1))
ss = fslbet(infile = t1_fname); ortho2(robust_window(ss))
bc_img = bias_correct(t1, correction = "N4"); bc_bet = fslbet(bc_img) ortho2(robust_window(t1), bc_bet > 0, col.y = red0.5)
We use the modification of BET in extrantsr
, which is called through fslbet_robust
. fslbet_robust
:
double_remove_neck
performs 2 registration steps, more robust than one (which is the default).)fslbet_robust
syntaxss = extrantsr::fslbet_robust( t1, remover = "double_remove_neck", correct = TRUE, correction = "N4", recog = TRUE)
ortho2(ss)
Avants, B. B., C. L. Epstein, M. Grossman, and J. C. Gee. 2008. “Symmetric Diffeomorphic Image Registration with Cross-Correlation: Evaluating Automated Labeling of Elderly and Neurodegenerative Brain.” Medical Image Analysis, Special issue on the third international workshop on biomedical image registration - WBIR 2006, 12 (1):26–41. https://doi.org/10.1016/j.media.2007.06.004.
Doshi, Jimit, Guray Erus, Yangming Ou, Bilwaj Gaonkar, and Christos Davatzikos. 2013. “Multi-Atlas Skull-Stripping.” Academic Radiology 20 (12). Elsevier:1566–76.
Jenkinson, Mark, Christian F. Beckmann, Timothy E. J. Behrens, Mark W. Woolrich, and Stephen M. Smith. 2012. “FSL.” NeuroImage 62 (2):782–90. https://doi.org/10.1016/j.neuroimage.2011.09.015.
Landman, Bennett A, Alan J Huang, Aliya Gifford, Deepti S Vikram, Issel Anne L Lim, Jonathan AD Farrell, John A Bogovic, et al. 2011. “Multi-Parametric Neuroimaging Reproducibility: A 3-T Resource Study.” Neuroimage 54 (4). Elsevier:2854–66. https://www.nitrc.org/projects/multimodal/.
Smith, Stephen M. 2002. “Fast Robust Automated Brain Extraction.” Human Brain Mapping 17 (3):143–55. https://doi.org/10.1002/hbm.10062.