Overall Pipeline

Image segmentation

  • We are often interested in subdividing or segmenting the brain into meaningful biological regions of interest (ROIs) for an analysis.
  • Examples: tissue segmentation, segmentation of deep gray matter structures, segmentation of pathology (MS lesions, tumors, …)
  • We will perform 3-class tissue segmentation in R using fslr and ANTsR:
    • Cerebrospinal fluid (CSF)
    • Gray Matter (GM)
    • White Matter (WM)

Loading Data

  • Let's read in the training T1 and brain mask for training subject 02.
library(ms.lesion)
library(neurobase)
all_files = get_image_filenames_list_by_subject(
  group = "training", 
  type = "coregistered")
files = all_files$training02 
t1 = readnii(files["T1"])
mask = readnii(files["Brain_Mask"])

Tissue Segmentation: Large Outliers

  • Many tissue class segmentations are based on k-means clustering.
  • These methods can be skewed by large outliers.
hist(t1, mask = mask, breaks = 2000); text(x = 600, y = 40000, '"outliers"')

Where are the outliers?

ortho2(rt1, t1 > 400, col.y = alpha("red", 0.5)) # xyz - cog of a region

What does the histogram look like after truncating outliers?

rt1 = robust_window(t1)
hist(rt1, mask = mask, breaks = 2000);