Session 1 fMRI Experimentation and Images

1.1 Overview

At the beginning of the session we will watch a video showing the process of acquiring the data at YNiC. This video shows you the safety and consent procedures we go through with participants and you will also see what is involved in acquiring the fMRI data itself.

After that we will use the YNiC Computer systems to begin looking at the raw structural and functional MRI data.

At the end of the session we will begin to prepare for the first fMRI analysis and and learn how to skull-strip structural data. The process involves understanding and navigating the file system - in fMRI analysis we use a lot of data and we have to be careful and well-organized in the way we store, move and copy it, so that we can keep track of the different sets of information, and so that computer based automated tools can find and access the information they need.

1.2 Learning Outcomes

By the end of this session you should have:

  • Seen an fMRI experimental session and understood:
    • Safety and consent issues involved in scanning for experimental purposes
    • How stimuli are presented in the scanner for visual and auditory modalities
    • The role of the experimenter and the operator
    • The purpose of the different acquisitions performed during a typical fMRI experiment:
      • Localiser scan and ASSET calibration scans
      • T1 structural scans (+ understand that some people use additional T1-FLAIR scans)
      • EPI (fMRI) scan(s)
    • Common terms involved in MRI scanning, especially:
      • Echo Time (TE)
      • Repetition Time (TR)
      • Matrix Size
      • Field of View (FOV)
  • Used existing structural and functional fMRI data (fMRI, T1) to characterise and understand the following concepts (using the FSL tools):
    • Matrix Size (number of voxels)
    • Field of view (FOV)
    • Voxel size
    • Number of volumes for fMRI data
  • Loaded structural images into FSLEyes and familiarised yourself with moving around and looking at both voxel and mm co-ordinates
    • Performed a brain extraction on the test T1 image and overlaid it on the non-brain extracted image using FSLeyes. Understood how to create a symbolic link and what it means.
    • Understood the difference between block and event-related designs

1.3 Programs and Tools

This week will introduce:

  • fsleyes
  • BET (The FSL Brain Extraction Tool)

1.4 Part 1 - fMRI Acqusition Video

You can also view the video on the VLE site.

1.5 Part 2 – Viewing and Characterising MRI images

In this part of the session we will look at some tools for examining MRI and fMRI data both graphically and using the terminal. Becoming familiar with these tools is important - you will be using them regularly.

1.6 Looking at Structural Scans

We are going to start by loading some structural and fMRI scans and looking at them. For the purposes of this demonstration, we will use the existing data from R2590.

Open FSLeyes by going to: Applications → Science → FSLeyes

You will see the FSLeyes window appear.

Go to File → Add from file:

FSLEyes File Menu

The Open File dialog will open:

FSLEyes Open Dialog

Navigate to the top folder: /

Navigate to: /mnt/mridata/R2590/20140623123456_STRUCTURAL by clicking each of the entries in turn.

You should see a list of files including:

  • 3_YNICT1A.nii.gz

Open 3_YNICT1A.nii.gz and you will see the following:

FSLEyes main window with T1 image loaded

There are several things to note in this window. First of all, at the bottom right-hand corner of the window, you can see the Voxel locations. These numbers tell you exactly where you are within the image.

You can also see the intensity of the currently selected voxel on the right in blue. In this particular example we are at voxel location [87, 127, 127] and the intensity is 2657.

In this particular case, we only have a single Volume of data loaded (because this is a structural image) so the Volume field is set to 0 and you cannot change it. Later, we will see that this is different when looking at fMRI data.

You should now experiment with moving around in FSLeyes and using the Zoom and Reset Zoom tools on the toolbar as well as using the zoom slider.

Whilst you are looking around at the structural data, familiarise yourself with the ability to change the layout of the images by clicking on the icons in the toolbar:

FSLEyes view toolbar

Now go to Settings → Ortho View 1 → Overlay information to show more information about the currently loaded image:

FSLEyes structural overlay information

You should examine this dialog carefully. In this pane, you can find the total size of the image in voxels as well as the size of the pixel dimensions of each voxel. For this particular T1 image, there are 256 x 256 voxels with 176 slices. Each of the voxels in the sagittal plane was 1.13 x 1.13mm and the slice thickness was 1.0mm. Make sure that you make a note of these T1 parameters for your report (or know how to obtain them afterwards).

Finally, to remove the overlay (T1 image), go to Overlay → Remove.

1.7 Looking at fMRI Scans

We now move on to examining fMRI data.

The fMRI data for this scan for this individual can be found in the participant’s P1318 folder: /mnt/mridata/R2590/20160804101153_P1318

Navigate to this directory and load the 5_BLOCK.nii.gz image.

FSLEyes showing a raw fMRI dataset

This time you will notice that the Volume field can be edited. It ranges from 0 to 179 – i.e. there are 180 volumes of fMRI data.

You can confirm this by looking in the Overlay Information dialog again (refer back to the previous section if you have forgotten how to find it).

To “play” the fMRI data as an animation, click on the Movie icon (FSLEyes movie icon) on the toolbar (if you get a corrupt graphics display when you do this, stop the movie, hide all but one view and restart it - this is a known graphics glitch on some systems, also note that the movie view does not work on some remote systems).

You will see the Volume number increase and then wrap around from the end to the beginning. To stop the animation, click on the icon again.

You can also view the fMRI time-series for each voxel. Click on: View → Time Series and the following window will appear.

FSLEyes fMRI time-series display

As you move around the brain in the main window, note that the time-series window updates to show the data for that voxel. The time-series that we are looking at here are the raw fMRI data which we will be using in our analysis in future weeks.

Before moving on, make sure you are comfortable with using FSLeyes – it will be an essential tool in future weeks.

1.8 Setting up our Analysis Directory

NOTE: Remember that HOME and SCRATCH refer to your specific file store areas (see Using the YNiC Computers in the introduction for a reminder).

The final part of this weeks’ practical is to use a command called Bet – the Brain Extraction Tool.

Before we start, we will create a directory where all of your analysis for this series of practicals will be stored. This folder (directory) will be called SCRATCH/MScPractical/fMRI. Again, we have two options:

Option 1: Using the file browser

  • Open the File Browser by going to Places → Home Folder.
  • Navigate to your SCRATCH folder by double-clicking Computer, then choosing /scratch/home on the left hand bar. This takes you to /scratch/home.
  • Navigate to your own folder within this area.
  • Go to File → Create Folder and name the folder MScPractical (note that there are no spaces and that the system is case-sensitive; do not use spaces in file or directory names).
  • Open the MScPractical folder and create a folder called fMRI
  • Finally, create a folder called anatomy inside your fMRI folder.
  • Your final path should look something like /scratch/home/n/nr100/MScPractical/fMRI/anatomy

Option 2: Using the command line

  • Type the command: mkdir -p SCRATCH/MScPractical/fMRI/anatomy. So, for the example user, the command would look like: mkdir -p /scratch/home/n/nr100/MScPractical/fMRI/anatomy.
  • mkdir is a command to make a directory. The -p flag tells the mkdir to create any folders which are needed as well as the final one (so this makes your MScPractical, fMRI and anatomy directories in one go.
  • Use your file browser to check that you have made the directory correctly.

1.10 The Command Line

As you saw in the preceding sections many jobs can be completed by typing commands in to the terminal. It is also possible to run scripts that perform complex sequences of commands stored in files, or programs (similar files using programming languages such as python) to carry out more complex computations.

When using the command line it is important to get every character just right. Any mistakes will either produce errors, or could lead to problems later (for example if a file is named wrongly and can’t be found in a later analysis).

There are various tricks for using the command line more quickly and some of these are captured in the commandline Appendix which also covers additional tools you may find useful.

Once you become comfortable with it, using the command line can save a lot of time, so you may like to learn about this in your own time.

In these introductory practical sessions we will focus on the alternative interactive approach using mouse, windows and menus where possible. This may make the process easier to understand for new neuroimagers, but you will likely need to learn to use the command line as you progress to more advanced methods. Most steps that we can carry out interactively with FSL can also be carried out using the command line, or in scripts. This allows large and complex analyses to be automated.

1.11 Managing files

As you’ve already noticed managing files and directories is an important part of neuroimaging analysis. If you are not already familiar with this process you will need to become proficient in organizing your data, using standardized and predictable names for your files and folders.

1.12 Brain Extraction

We are now ready to perform the brain extraction procedure. This procedure takes a structural image and creates a copy of it which only contains brain tissue; i.e. it removes the skull and other structures.

To perform the brain extraction, we will start FSL then open the Brain Extraction Tool. To start the main FSL menu, go to Applications → Science → FSL Default Version (6). The main FSL GUI (graphical user interface) will load:

Main FSL menu

Click on BET brain extraction and the BET tool will start:

Main BET window

We are going to skull-strip the individual’s T1 image. This is the image which we have just created our link to: SCRATCH/MScPractical/fMRI/anatomy/R2590_YNICT1A.nii.gz. We therefore click the open icon next to the Input image and find our file.

Bet will automatically set the output path to: SCRATCH/MScPractical/fMRI/anatomy/R2590_YNICT1A_brain.nii.gz

You should check that the output path is correct at this point! The most common problem with Bet is trying to output the file to the wrong place.

We then press Go on the user interface and the extraction process will run.

You should now open a file browser and check that the file has appeared in your anatomy directory (you may need to hit View → Reload in the file browser if you already have the directory open).

It is always essential to look at your brain extractions to check whether they have worked or not. To do this:

  • Start FSLEyes
  • Load the original image: SCRATCH/MScPractical/fMRI/anatomy/R2590_YNICT1A.nii.gz
  • Click on File → Add and choose your skull-stripped image: SCRATCH/MScPractical/fMRI/anatomy/R2590_YNICT1A_brain.nii.gz
  • To be able to see the skull-stripped image more clearly, make sure that it is highlighted and change the Lookup Table to Red
  • Change the transparency using the Opacity slider (this can be found to the left of the colour bars) so that the original image shows through the brain extracted image
  • Scroll through the brain and look at how well the extraction process has worked

Bet extraction displayed in FSLeyes ## Summary {#s1-summary}

In this session you learned * how fMRI data is acquired, * how to view MRI data (both structural and functional), * how to prepare a directory for data analysis, including how to locate and access data files and create symbolic links making them available for analysis * how to carry out brain extraction

1.13 Assessment

From this week, you should get at least the following things for your report:

  • Methods: details of the experimental design for the experiment.
  • Methods: details of the structural and functional MRI acquisition parameters. Help with this for structural scans can be found at: https://www.ynic.york.ac.uk/docs/TechInfo/MRI/StructuralScans
  • Methods: details of skull stripping and the tool (BET) used.

1.14 References

  • Brain-extraction
  • Handbook of Functional MRI Data Analysis. Chapter 4. Section 4.5.2. Pages 56-57.
  • Fast robust automated brain extraction, Smith, S. M., Human Brain Mapping, 2002, 17, 143-155
  • fMRI Experimental Design
  • Optimal design of multi-subject blocked fMRI experiment. Maus, B., van Bruekelen, G., Goebel, R., Berger, M.P.F., NeuroImage, 2011, 56(3), 1338-1352.
  • The CBU has a general introduction to design efficiency at: http://imaging.mrc-cbu.cam.ac.uk/imaging/DesignEfficiency

  1. If you are used to Windows, this is a bit like a Windows shortcut.↩︎