Brain tissue segmentation in MRI

Splits a brain MRI slice into background, skull, cerebrospinal fluid, grey matter and white matter, using only thresholds and morphological operations in MATLAB.

When
Dec 2021 to Jan 2022
Where
MSc coursework, image processing course, in a team of three
Built with
MATLAB, Thresholding, Mathematical morphology
Made as
Team project

About the project

The problem. Marking which part of a scan belongs to which tissue is called segmentation. The task was to label every pixel of a brain MRI slice as one of five classes: background, skull, cerebrospinal fluid (the clear fluid in and around the brain), grey matter or white matter. The slices were T1-weighted, an MRI setting in which white matter looks brighter than grey matter and fluid looks dark, and could come from any of the three viewing directions.

The idea. The slices we were given were very diverse, so we chose a deliberately simple method in MATLAB that uses only brightness and shape: thresholds and mathematical morphology. A threshold splits pixels into groups by brightness. Mathematical morphology changes the shape of a mask with a small probe shape: erosion shrinks it, dilation grows it, an opening (erosion, then dilation) removes small specks and a closing (dilation, then erosion) fills small holes. The block diagram in the second picture shows the whole chain.

  • Background: Otsu's threshold picks the brightness value that best splits the histogram into two groups, here head and background; the mask is then cleaned with an opening and a closing.
  • Three brightness bands: two multi-Otsu thresholds, the same idea with more than two groups, split the brightness range into three bands (third picture).
  • Brain mask: keep the two largest bright regions, erode them until brain and skull come apart, keep the larger one and grow it back (fourth picture).
  • Labels: inside the brain mask the three bands become cerebrospinal fluid, grey matter and white matter; what is bright outside it is skull.

The result. It works well on these scans, which were already preprocessed. Its weak point is the step that separates brain from skull: it assumes the brain is one connected region, so brain tissue that touches the skull gets labelled as skull.

My part. I wrote the methods section, made the block diagram and did the bibliography and the layout of the report.

More from Computer vision, AI and image processing

Get in touch

Let’s talk if you have a project in mind.