Overall Pipeline

Brain Extraction 3 Different Attempts

In this tutorial we will discuss performing brain segmentation using:

  • the brain extraction tool (BET) (Smith 2002) in FSL (Jenkinson et al. 2012)
    • without bias correction (method 1) and with (method 2)
  • a multi-atlas approach, called “multi-atlas label fusion” with the malf command (method 3).
  • (extra slides) a robust version using a wrapper function in extrantsr, fslbet_robust

MS Lesion T1

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

T1-weighted T1 Image

ortho2(rt1)

Attempt 1: Brain Extraction of T1 image using BET

Here we will use FSL’s Brain Extraction Tool (BET) to extract the brain tissue from the rest of the image (general overview):

  • 2nd and 98th percentiles are calculated. (98th - 2nd) * 10% + 2nd percentile used to threshold out background
  • From non-thresholded voxels - calculate center of gravity (COG)
  • Calculate radius of brain and median intensity of all points within “spherical brain” (used in last step)
  • Perform region growing and iterating to get brain surface
  • Smooth surface
  • Use median intensity to shrink surface to the “real” surface

Attempt 1: Brain Extraction of T1 image using BET

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)

FSL BET Results - Missing Brain Tissues (Posterior)

ortho2(robust_window(ss))

FSL BET Results not Satisfactory

ortho2(rt1, ss > 0, col.y = red0.5)

Attempt 2: Bias Correct before BET (recommended)

MALF for Skull Stripping

Figure from Multi-Atlas Skull Stripping method paper (Doshi et al. 2013):

  • Register templates to an image using the T1 for that subject
  • Apply transformation to the label/mask
  • Average each voxel over all templates
    • there are “smarter” (e.g. weighted) ways

MALF - use extrantsr::malf

  • Function requires arguments: template.images (T1-weighted images in this case) and template.structs (labels/structures/masks, brain masks here)
  • We will use the extrantsr::malf function
    • Performs non-linear registration using Symmetric Normalization (SyN) (Avants et al. 2008), a form of diffeomorphic registration:
    • combines the template structures
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

MALF performs well

mask = readnii("training01_01_t1_mask.nii.gz") # already computed
ortho2(bc_img, mask, col.y = red0.5)

Conclusions from the MS data

  • FSL BET can perform brain extraction (additional ex shows when it works)
    • It did not work sufficiently here
    • There are options you can change for performance
  • Bias-correction before brain extraction is a good idea
    • Especially if the method depends on intensities
    • Didn’t change the results here
  • MALF/MASS is a good option, but needs templates and is computationally expensive
    • weighted templates or local weighting is done in other software (not discussed)

Website

Extra Slides are showing additional BET options

Additional Example

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)

T1 image has the neck!

ortho2(robust_window(t1))

Neck messes up BET

ss = fslbet(infile = t1_fname); ortho2(robust_window(ss))

Recommend to Bias Correct first: not fixed

bc_img = bias_correct(t1, correction = "N4"); 
bc_bet = fslbet(bc_img)
ortho2(robust_window(t1), bc_bet > 0, col.y = red0.5)

BET with neck removal

We use the modification of BET in extrantsr, which is called through fslbet_robust. fslbet_robust:

  • bias correct image
  • remove neck (double_remove_neck performs 2 registration steps, more robust than one (which is the default).)
  • run BET
  • estimate center of gravity (COG)
  • run BET again with new COG

fslbet_robust syntax

ss = extrantsr::fslbet_robust(
  t1, 
  remover = "double_remove_neck",
  correct = TRUE,
  correction = "N4",
  recog = TRUE)

BET with neck removal - works well!

ortho2(ss)

Conclusions

  • Brain extraction allows you to analyze the brain only
    • Important for tissue segmentation/registration
  • BET may work (look at your data!)
    • Should bias correct first
    • May need to remove neck
    • High values may affect results - may need to remove/Winsorize them

Website

References

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.