[FSL] [TitleIndex] [WordIndex

BETA RELEASE

BIANCA is currently considered to be in testing, meaning that you will need to inspect its output a bit more carefully to see if you are happy with it. The output will depend critically on the choice of options and the quality of the training data and manual segmentations. Further recommendations and automated tuning methods, will be supported in an upcoming release.

Data preparation

Images preparation

BIANCA works in single subject's space, but all the MRI modalities need to be registered to a common base image.

Before running BIANCA you need to:

  1. Choose your base image. This will be your reference space for your input and output images.
  2. Perform brain extraction on (at least) one modality to be able to derive a brain mask *
  3. Register all the other modalities to your base image for each subject.

* If you want to further restrict the area were lesions will be detected (and reduce false positives) you can consider pre-masking as described in section on Masking)

Training dataset preparation

The algorithm requires a training set with pre-classified voxels (i.e. manually segmented images) that is used to create a set of feature vectors for lesion and non-lesion classes.

The lesion masks to be used as training dataset need to be:

Running BIANCA

Master file preparation

The master file is a text file that contains a row per subject (training or query) and on each row a list of all files needed for that subject:

These can be in any (consistent) order, as the following options will specify the meaning of each column.

Example master file (masterfile.txt):
subj01/FLAIR_brain.nii.gz subj01/T1_to_FLAIR.nii.gz subj01/FLAIR_to_MNI.mat subj01/WMHmask.nii.gz
subj02/FLAIR_brain.nii.gz subj02/T1_to_FLAIR.nii.gz subj02/FLAIR_to_MNI.mat subj02/WMHmask.nii.gz
...
subj<N>/structural/FLAIR_brain.nii.gz subj<N>/T1_to_FLAIR.nii.gz subj<N>/FLAIR_to_MNI.mat subj<N>/WMHmask.nii.gz

BIANCA options

Compulsory arguments:

Optional arguments:

BIANCA example call

bianca --singlefile=masterfile.txt --labelfeaturenum=4 --brainmaskfeaturenum=1 --querysubjectnum=1 --trainingnums=1,2,3,4,5,6,7,8,9,10 --featuresubset=1,2 --matfeaturenum=3 --trainingpts=2000 --nonlespts=10000 --selectpts=noborder -o sub001_bianca_output –v

With this command BIANCA will use data from masterfile.txt. It will look for information about pre-labelled images in the 4th column of the master file and will limit the search to the mask derived from the image in the 1st column. The subject to segment is the first subject of the master file (first row). Since this subject is also one of the training subjects, BIANCA will use only the remaining 9 for the training (like the LOO approach, to avoid bias and overfitting). BIANCA will use as spatial features the images in the 1st and 2nd columns of the master file. It will also extract the spatial features (MNI coordinate) using the transformation matrix listed in the 3rd column of the master file. For the training, BIANCA will use, for each training subject, (up to) 2000 points among the voxels labeled as lesion and (up to) 10000 points among the non-lesion voxels, excluding voxels close to the lesion’s edge. The output image will be called sub001_bianca_output. Verbose mode is on.

Post-processing

Threshold

BIANCA’s output is a 'probability' map of voxels to be classified as lesions. In order to obtain a binary mask, a thresholding step is needed. This can be easily done with fslmaths (e.g. to threshold at 0.9):

Check your own data to establish the best threshold (e.g. by evaluating the overlap with the manual mask – see section Performance Evaluation for more details)

Masking

If you see false positive hyperintensities due to artefacts such as CSF pulsation artefacts on FLAIR, it might be useful to apply a mask to exclude the affected region(s). Note that BIANCA is not optimized for segmentation of (juxta)cortical, cerebellar and subcortical lesions.

The script below creates an example of inclusion mask from T1 images, which excludes cortical GM and the following structures: putamen, globus pallidus, nucleus accumbens, thalamus, brainstem, cerebellum, hippocampus, amygdala. The cortical GM is excluded from the brain mask by extracting the cortical CSF from single-subject’s CSF pve map, dilating it to reach the cortical GM, and excluding these areas. The other structures are identified in MNI space, non-linearly registered to the single-subjects’ images, and removed from the brain mask.

make_bianca_mask <structural_image> <CSF pve> <warp_file_MNI2structural> <keep_intermediate_files>

The first input is the basename of the structural image (e.g. T1_biascorr). The script works under the assumption that the brain extracted image would be called <structural image>_brain.nii.gz. The second input is the CSF pve map (e.g. output from FSL-FAST). The third input is the non-linear transformation warp file from standard space to structural image. If you ran fsl_anat, you can use the file MNI_to_T1_nonlin_field.nii.gz in the fsl_anat output directory. If you have the warp file from structural to MNI, you can calculate the inverse with the command invwarp (invwarp -w warpvol -o invwarpvol -r refvol) If you use 1 for the last command line argument (keep_intermediate_files), the folder containing temporary files will not be deleted.

Main output file:

In case T1 is not your base space, you need to register the mask to the base space.

This mask can be applied to the BIANCA output (either before or after thresholding):

Alternatively, this can be used to mask the input image, creating a tighter brain mask:

where FLAIR_masked.nii.gz can be used instead of FLAIR_brain.nii.gz in the master file and used for the --brainmaskfeaturenum option.

Additional output:

Performance evaluation

The script below can be used to evaluate BIANCA performance against a manual (reference) segmentation:

bianca_overlap_measures <lesionmask> <threshold> <manualmask> <saveoutput>

It extracts the following overlap measures (see reference paper for details):

In addition it calculates:

The first input is the lesion mask calculated by BIANCA (e.g. sub001_bianca_output.nii.gz), the second input is the threshold that will be applied to <lesionmask> before calculating the overlap measures (if you have already thresholded and binarised the lesion mask you can simply put 0), the third input is the manual mask, used as reference to calculate the overlap measures. If <saveoutput> is set to 0 it will output the measures' names and values on the screen with the following order: SI, FPF, FNR, FPF(cluster-level), FNR(cluster-level), DER, OER, MTA, lesion mask's volume, manual mask's volume. If <saveoutput> is set to 1 it will save only the values (in the same order) in a file called Overlap_and_Volumes_<lesionmask>_<threshold>.txt in the same folder where the lesion mask is.

Volume extraction

The script below can be used to extract number of clusters (lesions) and the volume of lesions in any BIANCA output image.

bianca_cluster_stats <bianca_output_map> <threshold> <min_cluster_size> [<mask>]

If only 3 inputs are provided it will output the total number of clusters and the total lesion volume after applying <threshold> (if you have already thresholded and binarised the lesion mask you can simply put 0) and including clusters bigger than <min_cluster_size>, where the size is expressed in number of voxels.

To extract WMH volumes within a certain distance from the ventricles, as a measure of periventricular (or deep) WMH, you can do the following:

  1. Generate a ventricle mask (<structural image>_vent.nii.gz) from your T1 image with make_bianca_mask (see section Masking for details)

  2. (if needed) register it to your base image
  3. Create a distance map from the ventricles using FSL function distancemap, where the intensity of each voxel represent its distance in mm from the ventricles mask: distancemap <structural image>_vent.nii.gz dist_to_vent

  4. Threshold the distance map to obtain the region within <dist> mm of the ventricles, fslmaths dist_to_vent -uthr <dist> -bin dist_to_vent_periventricular or, alternatively, to look for deep WMH (more than <dist> mm from the ventricles) fslmaths dist_to_vent -thr <dist> -bin dist_to_vent_deep

  5. Use the obtained mask to calculate the volumes of WMH within that area with bianca_cluster_stats or to mask BIANCA output with fslmaths.


2017-04-20 13:23