This tutorial will guide you through data processing, analysis and visualization of your MRI data using mrTools.
After completing the tutorial you should be able to …
…appreciate the difference between epi images (data used for functional imaging and analysis) and T1-weighted anatomical images (pretty images often used for displaying analysis on
…understand the relationship between 3D surfaces and the T1-weighted anatomical images they are generated from
…determine the location of primary visual cortex
You will need to download the git repositories for mrTools and mgl and make sure they are in your Matlab path.
These should already be on your thumb drive under proj. If so, then do the following:
addpath(genpath('/Volumes/NSUR249/proj/mgl')); addpath(genpath('/Volumes/NSUR249/proj/mrTools'));
If you are running the latest Matlab / MacOS version there is some possibility you will run into problems with compiled files (.mexmaci64) not being recognized and causing problems. You can check that things are working properly by making sure you can run the command mrDisp (which is just like disp except it does not print with a newline character):
>> which mrDisp /Volumes/NSUR249/proj/mrTools/mrUtilities/MatlabUtilities/mrDisp.mexmaci64 >> mrDisp('Hello') Hello>>
If that did not look like what happened above, then you may wish to try recompiling mex binaries. You will need to have XCode, Apple's developers tools which has various compilers and other tools, installed and then you can do the following:
mglMake myDisp.c
mlrMake
First, in Matlab, set the plugins. Run the following command line which will bring up a dialog box. Make sure that GLM_v2 and pRF are selected.
mlrPlugin
Should look like the following:
Navigate to the directory that contains the data and start up mrTools
cd /Volumes/NSUR249/data/s0371/localizers/s037120180521 mrLoadRet
No matter what kind of experiment you do - you always want to look at the data you collect in as raw a format as you can. With neuroimaging this is even more important, because often data are processed with complex multi-step analyses and you can lose track of what features of your data give a result and get into real trouble. Lukily with imaging data, you can just look at your data, cause, well, it's a bunch of images. So let's do that first!
First thing to note is the “Group” drop-down at the top-left. We store data in different “groups” (folders on the harddrive) depending on what stage of analysis the data is in. We want to look at the “Raw” group - so:
Step 1: Select the “Raw” group
In MRI measurements there are different images made with different contrasts (for example, T1 or T2 or T2*-weighted images). For this purpose, just know that a typical anatomical image that you might see is “T1-weighted” where gray matter is gray, white matter is white and cerebral spinal fluid is black. You can take a look at that image by loading it as a “Base Anatomy”. A note here is that we can display summary statistics and data on many different kinds of base anatomies (we will see surfaces and flat-maps in a second). When we do so, we are just doing this for visualization - we transform the statistics on the fly to display on these base anatomies - we always keep the raw data in its original format (thereby avoiding messing with the original data too much by resampling and interpolation only when it is necessary to visualize). We always collect a T1 weighted anatomical image every session - this is used for visualization and for alignment with a canonical anatomy and surfaces (as we will see below).
Step 2: Load the T1 anatomy Should already be loaded (i.e. will look like the figure below with pictures of the brain), but if not, go to the menu item: File/Base Anatomy/Load and select the T1 weighted anatomy. Should be called something like “anat01_11954_2_1_T1w_9mm_sag.nii”
You should see the name of the anatomy appear in the Base drop-down and a picture of the brain appear. A few fun things to do here:
Step 3: Examine T1 anatomy Click on the “Multi” radio button. You should see 4 different views of the brain. If you click (make sure that Plots/Interrogate Overlay is unchecked) in any of the views (except the bottom-right one), it will update the other slices to show you that location in the brain. Explore!
Step 4: 3D anatomy view Another view that is sort of fun is to select the 3D radio button and move the 3D slice view around. Not sure that you learn anything different, but it looks kinda cool.
Ok. Cool. So, what about the “functional” data? Well, those are collected at a much faster-rate, typically with a fast imaging sequence known as EPI (Echo Planar Imaging), and have a T2*-weighted contrast. These are sensitive to the paramagnetism of deoxygenated hemoglobin (they get darker where there is more deoxygenated hemoglobin), let's take a look at these.
Step 5: Look at raw EPI images Go to Plots/Display EPI Images. You should see a viewer, where you can look at individual images or slices. Look at individual images. Click displayAllSlices and Animate over frames. This will show you a movie of all the images of the brain.
Note the different image contrast. What color is gray-matter? What color is white matter? How good is the resolution compared to the T1 we just looked at? Do you see evidence of head-motion? Do you see evidence of BOLD contrast (consider that large changes in BOLD are about a couple of % - do you think you could see them)?
It is often helpful to examine our data on renderings of the cortical surface. This is done by processing a high-resolution T1 image of the brain to find the borders between the gray and white matter and the surface of the brain. Then you can segment out just the cortical surface. This is useful since you can throw out data from outside the brain, or within the white matter and visualize on the cortical topography. FreeSurfer is a useful set of tools that can do this automatically on a T1 image (you type one command and then come back in 24 hours or so and it has segmented the brain and made triangulated surfaces. Check here if you wish to know more about surfaces and flat maps. In this section we'll just take a look at the surfaces so you can see a bit about how they are made.
In the Base dropdown, you should be able to select one of the inflated surfaces (e.g. s0371_left_inf or s0371_right_inf). If you do not see those in the dropdown, you may need to load them from the File menu (File/Base Anatomy/Load). To examine how the 3D surface relates to the underlying 3D anatomy, go to Plots/Surface Viewer
Two windows should open, the “View surface” window allows you to set which surfaces you will view data on. There are two visualiation surfaces, outersurface and innerSurface. By having two surfaces, we can provide a slider later which will allow you to smoothly interpolate between the outer and inner surface for visualization. We will therefore use the inflated surface for the outer and the gray matter for the inner surface. The coords surfaces are really important. They determine where the data will come from that you visualize on these surfaces. It is set up so that the gray and white mater surfaces are the coordinate surfaces so that we can interpolate data from within the cortex. The dialog should look like the following:
Examine the segmentation Remember the segmentation should show you the outer and inner surfaces of cortex. Let's examine if the algorithm found it correctly. You should see the 3D anatomy in the other window with white and yellow dots. The white dots indicate the gray matter white matter boundary. The yellow dots indicate the pial surface, or the gray matter/CSF boundary. Scroll through the slices, do you see any errors? I.e. white matter that snuck in, gray matter that was left out, etc? Does the segmentation fail in any specific parts of the brain? How noisy does the gray matter and white matter look?
Often it is convenient to look at data on a flattened piece of cortex (makes it easier to view V1). Let's examine a flat patch. In the Base dropdown menu select s0371_left_occipital.
Ok. Now we're ready to look at the pRF analysis.