Jason Stein, Anderson Winkler, Roberto Toro

Last update: 29.Jun.2010.



FIRST Protocol

Data Structure and Organization

  1. For this protocol we will assume you are working in the directory on your own network called /enigma/hippo.
  2. Put your unprocessed structural MRI scans for each subject in the /enigma/hippo/data directory. We assume they are called subj1.niisubj2.nii, etc.  No pre-processing of the structural scans is necessary.
  3. Create a directory to store your scripts called /enigma/hippo/scripts.

Set up FSL

  1. Install and set up FSL version 4.1.5 which includes FIRST version 1.2 from the FSL website.
  2. If you have multiple versions of FSL on the same machine, make sure you are using the correct one. You can check this by typing cat ${FSLDIR}/etc/fslversion and making sure the output says 4.1.5.
  3. Set up the fsl_sub command found in ${FSLDIR}/bin/fsl_sub.  This command will allow you to submit jobs to your grid engine if you have one or run on just your computer alone.  The file is a shell script and is editable by any text editor provided you have the appropriate permissions. We recommend this activity to be done by your system administrator.
  4. Become familiar with the instructions for running FIRST.

Modify FIRST settings

  1. Copy the file ${FSLDIR}/bin/run_first_all to the scripts directory and rename it.  cp ${FSLDIR}/bin/run_first_all /enigma/hippo/scripts/run_first_all_edit. This is the driver script for running FIRST.  We will edit this file to have different settings than the default.
  2. Copy the file ${FSLDIR}/bin/first_flirt to the scripts directory and rename it.  cp ${FSLDIR}/bin/first_flirt /enigma/hippo/scripts/first_flirt_edit. This is the driver script for running the linear registration via FLIRT.  We will edit this file to have different settings than the default because through experience the registration is very poor based on the default parameters.
  3. Edit the first_flirt_edit file in your favorite text editor.  For example, emacs /enigma/hippo/scripts/first_flirt_edit. Change the line which now reads:
  4. ${FSLDIR}/bin/flirt -in $A -out ${B}_tmp_stage1 -ref ${FSLDIR}/data/standard/${refim} -omat ${B}_tmp_stage1.mat $inweightCom

    TO

    ${FSLDIR}/bin/flirt -in $A -out ${B}_tmp_stage1 -ref ${FSLDIR}/data/standard/${refim} -omat ${B}_tmp_stage1.mat $inweightCom -cost normmi -searchrx -180 180 -searchry -180 180 -searchrz -180 180

    Save and close the file.  This changes the cost function and search space to what has been in my experience something that will more likely work.

  5. Edit the run_first_all_edit file in your favorite text editor.  For example, emacs /enigma/hippo/scripts/run_first_all_edit.  Change the lines which now read:
  6. FLIRTID=`${FSLDIR}/bin/fsl_sub -l $logdir -T 15 ${FSLDIR}/bin/first_flirt $iname ${matname} $opts`

    TO

    FLIRTID=`${FSLDIR}/bin/fsl_sub -l $logdir -T 15 /enigma/hippo/scripts/first_flirt_edit $iname ${matname} $opts`

    Save and close the file.  This specifies to use the modified first_flirt file.

Run First

  1. Change directories to the data directory: cd /enigma/hippo/data
  2. Run the modified FIRST command: /enigma/hippo/scripts/run_first_all_edit -i subj1.nii -o subj1_first12. Assuming you are using a bash shell (if you want to put this into a script add #!/bin/bash to the top of the script), you can run this in a loop by using:

  3. for subj_id in (subj*.nii) ; do
    subj_id_nosuffix = `basename subj_id .nii`
    /enigma/hippo/scripts/run_first_all_edit -i ${subj_id_nosuffix}.nii -o ${subj_id_nosuffix}_first12
    done

  4. This will take upwards of 4 hours to run per subject.  Also, make sure to use a node with a lot of memory.  In my experience 2GB memory is not enough and the process will die without informative errors.  It runs fine with 4GB memory.
  5. You will know when the process has finished because the file subj1_first12_all_fast_firstseg.nii.gz will appear.  This represents the segmented image.

Quality Checking

  1. The most likely place that the program will fail is at the initial registration step.  In order to check the registrations, run:${FSLDIR}/bin/slicesdir -p ${FSLDIR}/data/standard/MNI152_T1_1mm.nii.gz *_to_std_sub.nii.gz.  This will produce a webpage in the directory where you run it that you can then easily check the registrations for each step.  When the registrations are bad, they are very bad (brain is upside down, zoomed in, zoomed out, etc.) so it is easy to tell when something is wrong. For further information, please see: Protocol for Quality Control and Summary Statistics.
  2. If the registrations are unsuccessful, try to skull strip your data using BET prior to running FIRST.  Then, when you run FIRST again use the following command: /enigma/hippo/scripts/run_first_all_edit -b -i subj1_brain.nii -o subj1_brain_first12.  After you run this do a quality check again using the website generating command above.  For a protocol about running BET, please see: Protocol for Brain and Intracranial Volumes.
  3. Check the segmentations.  To do this, type fslview subj1.nii subj1_first12_all_fast_firstseg.nii.gz -l Blue-Lighblue.  The labels should cover the full hippocampus. This should be done for all subjects who do not pass the quality control criteria defined in the Quality Control protocol.  It is possible to do this for all subjects at about the rate of 50 subjects per hour if going quickly.  For further information, please see: Protocol for Quality Control and Summary Statistics.

Get the volume of hippocampus for each subject

  1. The volume of the left hippocampus for each subject can be obtained by using the command: fslstats subj1_first12_all_fast_firstseg.nii.gz -l 16.5 -u 17.5 –V.  This will output two numbers, and you want to record the second number for each subject which is the volume of the left hippocampus in mm3. You can put this into a for loop using the commands below (if you want to put this into a script add #!/bin/bash to the top of the script):
  2. echo "SubjID,Volume" > LHippo.csv
    for subj_id in `ls subj*.nii` ; do
    subj_id_nosuffix=`basename ${subj_id} .nii`
    echo ${subj_id_nosuffix},`fslstats ${subj_id_nosuffix}_first12_all_fast_firstseg.nii.gz -l 16.5 -u 17.5 –V | awk '{print $2}'` >> LHippo.csv
    done

  3. The volume of the right hippocampus for each subject can be obtained by using the command: fslstats subj1_first12_all_fast_firstseg.nii.gz -l 52.5 -u 53.5 –V.  This will output two numbers, and you want to record the second number for each subject which is the volume of the right hippocampus in mm3. You can put this into a for loop using the commands below (if you want to put this into a script add #!/bin/bash to the top of the script):
  4. echo "SubjID,Volume" > RHippo.csv
    for subj_id in `ls subj*.nii` ; do
    subj_id_nosuffix=`basename ${subj_id} .nii`
    echo ${subj_id_nosuffix},`fslstats ${subj_id_nosuffix}_first12_all_fast_firstseg.nii.gz -l 52.5 -u 53.5 –V | awk '{print $2}'` >> RHippo.csv
    done

  5. Average the volumes in each subject. The average volume is the phenotype used in this study. Perform GWAS on your data using the hippocampal volume as phenotype according to the GWAS protocols provided.  Also, please calculate summary statistics and check your data according to this protocol: Protocol for Quality Control and Summary Statistics.

Where to find help

General information about the ENIGMA and this protocol can be found in the consortium website:

http://enigma.ini.usc.edu

Questions about image processing related to this project can be directed to our mailing list.
Subscribe to be informed and receive the latest updates by clicking the join button at the top of this page.

And send emails to: enigma@lists.ini.usc.edu

General documentation and support for FreeSurfer and FSL can be found in their respective websites and mailing lists:

ENIGMA on social media: