FIRST is FSL’s tool for automatic segmentation of a number of subcortical structures. The supported structures are:


The abbreviated names in parenthesis are the names that FIRST uses. To segment these structures, FIRST needs a good quality T1-weighted image. Such an image is included in most studies, as it is typically also used for registration purposes.

Running FIRST for a single subject

Only a single command is required to segment all of the required structures with default options (which is recommended). It is important to inspect the output afterwards, however, and this is also part of the step-by-step guide.

  1. Run FIRST with the command:
    run_first_all -d -i <name of your t1 image> -o <output name>
    • If your input file is already brain-extracted, i.e. it is the output from bet, add the -b option. The option -d prevents FIRST from deleting the masks for individual structures - if you will not use these files, you can remove the option.
    • The output name is used as a prefix for the segmentation output; the subject ID might be a good choice. For example, specifying -o 0002 would generate a left hippocampus segmentation called 0002_L_Hipp_first.vtk, a right putamen segmentations called 0002_R_Puta_first.vtk and so forth.
    • Note that the output from the registration step uses filenames derived from the name of the input images, so if you specify a different directory using -o, these files will end up in the directory of the input image.
  2. After FIRST has completed, inspect the segmentations that it produced. To do this, load your original T1-weighted image in fslview and overlay the file
    <your output name>_all_fast_firstseg.nii.gz.

    • This is a 3D file containing the final segmentations after full boundary correction, which ensures that structures do not overlap. This file is very useful as a quick overview of all the segmentations that FIRST produced. Use the MGH-Subcortical color map in fslview (this is normally selected automatically). By toggling the visibility of the segmentation masks, you can check the quality of the segmentations.
  3. In addition to these segmentation masks, a number of other files should have been created by first. The most important ones are:
    • <your output name>_all_fast_origsegs.nii.gz

    • This is a 4D image in which each 3D volume is the segmentation mask for one of the structures. The intensities in the image correspond to the label for each structure as listed at the end of the FIRST user guide, which can be found in the FIRST User Guide. Note that boundary voxels have 100 added to their intensity - this is just for visualisation. Segmentations are generated in the native coordinate system of the original image and can be overlaid in fslview. The segmentations can be subtly different from those in the _firstseg.nii.gz file, as boundary correction has not been applied to the _origsegs.nii.gz segmentations.

    • <your output name>_X_YYYY_first.bvars and <your output name>_X_YYYY_first.vtk

    • These are the other main segmentation output files, obtained by segmenting the different structures independently. In the filenames, X is the hemisphere and YYYY is the name of the structure (see the list above). The .bvars files contain the model parameters and are used for shape analysis, which will be described in the next section, while the .vtk files can be used for 3D visualisation in fslview.
    • <your input image filename>_T1w_to_std_sub.mat and <your input image filename>_T1w_to_std_sub.nii.gz

    • The .mat file is the affine matrix found during registration using first_flirt, which is optimised for the subcortical structures. The .nii.gz is the input image registered to the template using that transform. These files can be useful in diagnosing problems - if the segmentation is wildly off, registration is one of the first things to look at.
    • <your output name>_X_YYYY_first.nii.gz and <your output name>_X_YYYY_corr.nii.gz

    • These files are the masks corresponding to the parameters stored in the .bvars file. The _first.nii.gz is the original output, while the _corr.nii.gz files may have had boundary correction applied to them (this depends on the structure). These files are deleted by FIRST if the -d option is not used.


Performing a vertex (group) analysis with FIRST

This section describes how to perform a vertex analysis, which is the ‘standard’ group-level analysis for FIRST.

  1. Run FIRST on all of your subjects’ data. The user guide on the FSL wiki has some tips on structuring your data directory and filenames. Once you have decided on data organisations, run run_first_all on all of the datasets; the wiki also contains some tips for scripting this. For a description of the output files, see the single-subject step-by-step guide.

  2. Check that FIRST produced good quality segmentations. The quickest way to do this is to run
    first_roi_slicesdir <names of T1 images> <names of masks for a structure>
    • An actual command line might look something like this:
      first_roi_slicesdir subj??_struc.nii.gz subj??-L_Caud_first.nii.gz
    • This generates a webpage that shows the mask for the left caudate nucleus overlaid on the T1 volume for each subject. Open the slicesdir/index.html file in your web browser to view the report. Note that in the first example we used the non-boundary corrected files, as these are closest to the segmentations that are used for vertex analysis. If you want to generate another report for a different structure, rename slicesdir first, as the output is always given that name! This step is one of the reasons that we used the -d option - otherwise the masks for individual structures would have been deleted by FIRST.
    • To look at all structures at once, you can use the command
      first_roi_slicesdir subj??_struc.nii.gz subj??-all_fast_firstseg.nii.gz
      • These images may be harder to assess, so if you are only interested in one or two structures, it is probably a good idea to examine these in isolation using the commands above.
    • To have a closer look at the segmentations, use fslview as described in the single subject guide.
  3. You are now ready to set up your group analysis. The statistical analysis will be performed using randomise, FSL’s tool for non-parametrical inference. You will need to set up a general linear model (GLM) that corresponds to the design of your experiment - use the Glm or Glm_gui (on Mac) graphical interface (select ‘higher level’) to generate the necessary files. A list of examples, as well as a link to a set of intro slides, is provided on this wiki: http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/GLM

    • One of the simplest and most commonly used models is an unpaired t-test for the difference in means between two groups. This is explained at the top of the wiki page and can be set up automatically using the command:
    • design_ttest2 <output design name> <size of first group> <size of second group>
    • This will generate two files with the output name and extensions .mat and .con. The first file is the design matrix and the second one specifies the contrasts.
  4. As randomise cannot read the .bvars files that contain the parameters of the shapes, these files need to be converted to a form that it can use. This is done using the commands:
    concat_bvars concatenated.bvars <list of .bvars files>
    
    first_utils --vertexAnalysis --usebvars --useReconNative -- useRigidAlign -i concatenated.bvars -d <design>.mat -o <output name>
    • The list of .bvars files should list all subjects in the order in which they need to be included in the design matrix. It is a good idea to have your filenames differ only by a numerical subject ID as this will allow you to specify a pattern like subj????.bvars - this will automatically be expanded to all matching filenames in alphabetical (and numerical) order. If you have two groups, you can specify a pattern like control????.bvars patient????.bvars. To see what files will be filled in before running the command, you can prepend “echo “ to the command line to check.
    • The second command (first_utils) creates a 4D nifti file with one volume per subject. In each volume, the amount by which the surface of the shape was moved outwards or inwards for the corresponding subject is stored in the voxel values along the outline of the shape. Note that this outline is the same for all subjects, to enable randomise to do per-voxel statistics. See the wiki for a more detailed description of this process and for information on the difference between --useReconNative (also specify --useRigidAlign if you use this) and --useReconMNI. This is quite an important issue as it determines whether brain size is removed from the reconstructions or not.
    • After this step, you should have two output files, <output name>.nii.gz and <output name>_mask.nii.gz, which you can feed into randomise.

  5. Run the statistics with the command (name is the output name from the previous step)
    randomise -i <name>.nii.gz -m <name>_mask.nii.gz -o <design>_randomise -d <design>.mat -t <design>.con --T2
    • The option --T2 tells randomise to use 2D-optimised TFCE multiple comparisons correction, which is appropriate as the data are on a surface. See the wiki for information on how to run randomise if your design contains F-contrasts.
  6. To view the results, overlay the *_tfce_corrp_tstat?.nii.gz files on the mask. For example:
    fslview <name>_mask.nii.gz $FSLDIR/data/standard/MNI152_T1_1mm_brain - b 0,1 -l Green <name>_tfce_corrp_tstat1.nii.gz -l Red-Yellow -b 0.95,1 <name>_tfce_corrp_tstat2.nii.gz -l Blue-Lightblue -b 0.95,1
    • This command shows the outline of the structure in green overlaid on the MNI152 template. Significant positive changes (i.e. local enlargements) are red, negative ones are blue (assuming you specified the contrasts in such a way - adapt as needed). The volumes actually contain 1-p values, so a display range of 0.95 to 1 shows voxels that survive at p <= 0.05 family-wise.

 

FIRST/StepByStep (last edited 19:01:54 02-02-2015 by MarkJenkinson)