Example Box: Troubleshooting Brain Extraction

Introduction

The aim of this example is to explore ways of troubleshooting brain extraction.

This example is based on tools available in FSL, and the file names and instructions are specific to FSL. However, similar analyses can be performed using other neuroimaging software packages.

Please download the dataset for this example here:

Data download

The dataset you downloaded contains the following:


Viewing the Data

To start with load the original image into a viewer (e.g. fsleyes) and inspect the image. Then load the different brain extracted images and view them. Note particularly how accurate they are in the inferior regions (especially in the cerebellum, where a lot is missing in some cases) and the superior regions.


Generating the Brain Extractions

We will now show how to generate these results with the FSL tool BET. The main parameters that have been changed in this case are the "fractional intensity threshold" and the "threshold gradient". As explained in a previous example box these can be adjusted through the GUI. Here we will show how to run these with the command line version of BET instead (though feel free to use the GUI instead if you prefer).

The default brain extraction is performed at the command line like this:

bet struct struct_brain

where we leave off the .nii.gz extensions for the input and output filenames (first and second names respectively, after "bet"). It is also fine to leave the extensions in - either way works.

Run this command and check that the output is as expected, by looking at it in a viewer.

Since this default result is not very good, especially in the cerebellum, we will try other options. For example, reducing the fractional intensity threshold can include more brain in the result, so try:

bet struct struct_brain_f03 -f 0.3

and then view the result (struct_brain_f03.nii.gz). Note the differences with respect to the default result.

We can also combine this with the "threshold gradient" option to make the bottom part larger and the top part smaller (by using a positive value; a negative value goes the other way). To do this we run:

bet struct struct_brain_f03g01 -f 0.3 -g 0.1

Try this and see what the result looks like.

See if you can replicate the result of struct_brain_2.nii.gz with these options (or do better than this). The options that were used to generate this example can be found here - but resist peeking at this before you try it yourself!


Alternative Brain Extraction Methods

Within FSL there is another tool for brain extraction: fsl_anat. This does a lot more than just brain extraction, such as removing the bias field (effect of B1 or RF inhomogeneities) as well as doing registrations and segmentations of the image. You can easily run this here with this command:

fsl_anat struct

which will take a lot longer to run than BET (probably around 20-30 minutes) but will produce a lot of results in a directory called struct.anat

I you have time, try running this command and then looking in the output directory. The key images for us now are T1_biascorr.nii.gz (a cropped, bias-corrected version of the original image - and note the image T1.nii.gz is just a copy of this, whereas T1_orig.nii.gz is a copy of the initial image) and T1_biascorr_brain.nii.gz which is the brain extracted version. Have a look at this and see how it is generally tighter, although not absolutely perfect. There are also registered and segmented versions of the image in this directory - feel free to explore these and look at the documentation on the FSL wiki.


There are actually a wide range of options for brain extraction besides what we've shown here. Within FSL you can find the option for BET either on the FSL wiki or by typing "bet" at the command line and pressing return, which will show you many options, most of which are only available in the command line version and not through the GUI. This is one of the reasons why it is useful to learn how to use the command line.

The first time you work with a particular scanner and sequence you are likely to have to try various brain extraction options, but once you find a good setting it should work similarly for all other images using that sequence on that scanner. Hence this trial and error approach for brain extraction is normally only necessary to fine tune for the first few subjects in any new experiment.