User Tools

Site Tools


biac:courses:sample_fsl_1stlevel

Setting up FSL

  • For reference, the FSL-FEAT analysis guide is available at http://www.fmrib.ox.ac.uk/fsl/feat5/
  • A glossary containing descriptions of the output files from FSL-FEAT is available at http://www.fmrib.ox.ac.uk/fsl/feat5/index.html
  • For this exercise, you'll need to open the command terminal on the Mac and this can be done by going up to “Utilities” and selecting “Terminal”. You'll open FSL via this terminal, and you'll move/copy files in this command window. You'll also use MATLAB for one part of the exercise, so go ahead and open that as well. DO NOT USE THE XTERM TERMINAL THAT OPENS WITH MATLAB.

Organizing Your Data

Note that on Linux/Unix systems, capitalization matters! Make sure that you correctly capitalize directory and file names. Also note that you only have write access in the “classwork” folder, so you won't be able to direct output or make new files/folders elsewhere.

  • In /afs/acpub/project/neurobio381/classwork/Fall_2008/Students create a folder for yourself (e.g., mkdir yourfoldername). It is helpful to keep open an explorer window, and the easiest way to do this will be to double-click on the classwork icon on your desktop. You should be able to navigate to your folder from there.
  • From /afs/acpub/project/neurobio381/datasets/Class.01/Examples COPY, DO NOT CUT!!! ANAT_4 and FUNC_4/Run1_Block and paste them in your folder, renaming them Anat and Func. These are pretty big, so it may take a minute or two.
cp -r /afs/acpub/project/neurobio381/datasets/Class.01/Examples/ANAT_4 /afs/acpub/project/neurobio381/classwork/Fall_2008/Students/David/Anat 
cp -r /afs/acpub/project/neurobio381/datasets/Class.01/Examples/FUNC_4/RUN1_Block /afs/acpub/project/neurobio381/classwork/Fall_2008/Students/David/Func 
  • Create a new folder called FSL in your folder

Preparing Your Data for Analysis

Before we do any processing on our data, we have to reorient the the data into LAS and convert it from our unique BIAC format (e.g., xml headers with .img files) to NIFTI format. This is easily done with a BIAC tool called bxh2analyze; however, this has all been done for you in this lab and it will be done for the data you acquire later this semester.

Extracting the Brain

This removes the surrounding skull and tissue from the anatomical images.

  1. First make sure you're in the directory you created.
  2. In your command terminal type: fsl &
  3. This will bring up a GUI, click BET brain extraction. This tool will allow you to remove non-brain material.
  4. For the input image select the anat.nii.gz file, which is in the the Anat folder you made. The output image will autmatically be called anat_brain
  5. Fractional intensity should automatically be set to .5 (smaller == more conservative)
  6. Run standard brain extraction using bet2 should be the option that is automatically selected checked.
  7. Click Go.
  8. This should take about 20 seconds to run. When it finishes, you will have a new file in the Anat directory: “anat_brain.nii.gz”. You should view this file in MATLAB using showsrs2, to see the effects of brain extraction (e.g., anatb=readmr('anat_brain.nii.gz'))

Running FSL Analyses

We'll begin with a first-level analysis (i.e., on only one run of one subject's data). To save time, we'll split this into two parts: 1.) preprocessing and 2.) stats

  1. Move (don't just copy) the run1.nii.gz file (which is in the Func folder you made) into the FSL folder. Also move the anat_brain.nii.gz file into that folder.
mv /afs/acpub/project/neurobio381/classwork/Fall_2008/Students/David/Func/run1.nii.gz /afs/acpub/project/neurobio381/classwork/Fall_2008/Students/David/FSL/run1.nii.gz 
mv /afs/acpub/project/neurobio381/classwork/Fall_2008/Students/David/Anat/anat_brain.nii.gz /afs/acpub/project/neurobio381/classwork/Fall_2008/Students/David/FSL/anat_brain.nii.gz 
  1. In the command terminal, change into your FSL folder (e.g., cd where_ever_you_want_to_go).
  2. If FSL is not already open, type fsl & and click FEAT FMRI Analysis in the GUI. Just click once; it will take a few seconds to appear.
  3. Go to this webpage - http://www.fmrib.ox.ac.uk/fsl/feat5/detail.html - and follow along to read about each setting you are changing

FSL GUI settings: Preprocessing

  1. Pull-down menus
    • At top, the left menu should read First-level analysis. The right menu should read Full analysis. You need to change this right menu to Pre-stats. You'll notice the “Stats” and “Post-Stats” tabs will be grayed out now.
  2. Misc tab
    • Click on this tab. You should leave everything on this tab at the default settings.
  3. Data tab
    • Click on this tab, next.
    • Make sure that Number of Analyses is set to 1.
    • Click Select 4D Data and select the run1.nii.gz file that you copied into the FSL folder earlier. Click OK twice, ignoring any error messages at this stage.
    • Click Select Output Directory, type “prestats” into the selection box, and click OK.
    • Check to make sure your Total volumes is set to 131 (should have changed when you selected your func data)
    • Set the TR(s) to 2. This is your repetition time (TR) in seconds.
    • You shouldn't have to change anything else. The defaults should be correct: Delete Volumes = 0, High-Pass Filter cutoff (s) = 100.
  4. Prestats Tab
    • Motion correction should be MCFLIRTThis will remove rigid motion from the time series
    • B0 unwraping should be unchecked (gray)
    • Slice timing correction should be Interleaved
    • BET brain extraction should be checked (yellow) – This is doing BET on the functional data. You did it on the anatomical earlier.
    • Spatial smoothing should be set to 8mm
    • Intensity normalization should be unchecked (gray)
    • Temporal filtering should be Highpass
    • Melodic ICA should be unchecked (gray).
  5. Registration Tab
    • Standard space should already be checked, with the file /usr/local/fsl/data/standard/MNI152_T1_2mm_brain, Normal Search, and 12 DOF.
    • Click the Main structural image checkbox. Select your anat_brain.nii.gz file and then click OK. You should have Normal Search and 7 DOF selected automatically.

Now click Go in the lower left of the GUI and prestats will start running. This will take about 15-20 minutes.

FSL GUI settings: Stats

Step 1: Setting up your timing files

This is the part of analysis where you specify what happened in the experiment. For your reference, here is the description of the experimental paradigm:

A static checkerboard is displayed for the first two TRs (4s). Alternating blocks begin with the third TR. The first block displays a flashing checkerboard for 10 TRs (20s). The second block displays a static checkerboard for 10 TRs (20s). This set of flashing/static blocks is repeated six times. After the final static block, another 6 TRs (12s) of flashing checkerboard appeared before the run ended.

You need to create a three-column text file that describes your experimental paradigm. Each line of the file consists of three values, separated by tabs.

  • The three columns are: Start of event (seconds), Duration of event (seconds), and Intensity of event.
  • So, for the first row of the text file, we could use:
4     20       1
  • You need to create a text file that has seven rows, each corresponding to one of the blocks of visual stimuli. Save this file in your FSL directory as block_3col.txt.
#from within your FSL directory 
touch block_3col.txt 
open -a TextEdit block_3col.txt 

Step 2: Setting up your Design in FSL

  1. Pull-down menus
    • At top, the left menu should read First-level analysis. The right menu should read Pre-stats. You need to change this right menu to Stats + Post-stats. You'll notice the “Pre-Stats” tab will be grayed out now.
  2. Misc tab
    • Click on this tab. You should leave everything on this tab at the default settings.
  3. Data tab
    • Click on this tab, next.
    • Make sure that Number of Analyses is set to 1.
    • Click Select 4D Data and select the filtered_func_data.nii.gz file that was created in the preprocessing step. This file will be located in the output directory from the preprocessing step (e.g., prestats.feat)
    • Click Select Output Directory, type “stats” into the selection box, and click OK.
    • Check to make sure your Total volumes is set to 131 (should have changed when you selected your func data)
    • Set the TR(s) to 2. This is your repetition time (TR) in seconds.
    • You shouldn't have to change anything else. The defaults should be correct: Delete Volumes = 0, High-Pass Filter cutoff (s) = 100.
  4. Stats Tab
    • Use FILM prewhitening should be checked. This prewhitens and and does an AR(1) correction.
    • Add motion parameterers should be No
    • To set up the design, click on Full model setup.
    • In this experiment, only one thing happens: a checkerboard flashes. So, we only need one Explanatory Variable (EV). Type Flash into the EV name field.
    • On the Basic shape pull-down menu, select Custom (3 column format). When the Filename box pops up, select the block_3col.txt file that you just created.
    • On the Convolution pull-down menu, select Double-Gamma HRF. Leave Phase at 0 seconds.
    • Add temporal derivative should be unchecked (gray).
    • Apply temporal filtering should be checked (yellow).

You can now click on View Design, and you should see something that looks like the predicted hemodynamic changes that should follow alternating blocks of activation and deactivation. Close the window that just popped up (not your main FSL window), and hit “Done”.

  1. Post-Stats Tab
    • The key part of this is Thresholding. From left to right, it should read Cluster, Z Threshold 2.3, and Cluster P threshold 0.05.
  2. Registration Tab
    • Standard space should already be checked, with the file /usr/local/fsl/data/standard/MNI152_T1_2mm_brain, Normal Search, and 12 DOF.
    • Click the Main structural image checkbox. Select your anat_brain.nii.gz file and then click OK. You should have Normal Search and 7 DOF selected automatically.

Now click Go in the lower left of the GUI and stats will start running. This will take about 5-10 minutes.

Looking at your FSL analyses

  • FSL creates HTML pages for your output; these can be viewed in Internet explorer or any other browser.
  • Both of the analyses above should have opened webpages to which FSL will write its summary output.
  • In the Prestats output, you will be able to see how much the subject moved (i.e., how much the data was adjusted). You can also check the registration to make sure the images were normalized properly
  • In the Stats output, you can see the results in the post-stats tab and the model you specified in the stats tab.
biac/courses/sample_fsl_1stlevel.txt · Last modified: 2014/08/04 16:03 (external edit)