• Blog
  • About
  • Publications
  • Videos
  • Workshops
  • CV
  • Contact Me
  • Hall of Fame
Menu

Andy's Brain Blog

Street Address
City, State, Zip
Phone Number
fMRI, Neuroimaging, and More

fmri, neuroimaging, and more

Andy's Brain Blog

  • Blog
  • About
  • Publications
  • Videos
  • Workshops
  • CV
  • Contact Me
  • Hall of Fame

fMRI Lab: ROI Analysis in FSL

May 2, 2017 Andrew Jahn

In any fMRI analysis package, there are three steps for doing ROI analysis: 1) Masks are created using either spheres or an atlas; 2) data is extracted from the masks; and 3) these data are then analyzed with whatever statistical software you like.

In FSL we create spherical masks with the command fslmaths, similar to how we create masks with SPM's Marsbar or AFNI's 3dUndump. Let's say you wish to create a 5mm spherical mask placed at the MNI coordinates 0, 30, 30. Open up a template in fslview (the same template that your functional data was warped to), enter those coordinates, and note the voxel coordinates in the fields directly to the left of the MNI coordinates (see 1:30 in the video). In this case, our voxel coordinates are 45, 78, 51. We will use fslmaths to 1) create a single-voxel mask at that coordinate; 2) draw a 5mm sphere around that coordinate; and 3) binarize the mask so that all the voxels inside the mask have the value 1, and so that all voxels outside the mask have the value 0.

Here are the steps:

1. Create a single-voxel mask at the MNI coordinates 0, 30, 30 (voxel coordinates 45, 78, 51):

fslmaths $FSLDIR/data/standard/MNI152_T1_2mm.nii.gz -mul 0 -add 1 -roi 45 1 78 1 51 1 0 1 ACCpoint -odt float

Explanation: The first two arguments replace with zeros all of the data in the template. Think of this step as creating a canvas on which to draw the masks; and since the functional data was warped to this template space, the resulting mask will have the same boundaries and voxel dimensions as the data you extract from. The first six numbers after the -roi option fill in those voxel coordinates with a 1, and the last duplet (0 1) specifies that we are using the first frame of the template; i.e., it is a 3D dataset, not a 4D dataset. The last two arguments specify the output name (ACCpoint) and the precision of the output data. Float is the most precise; and although this makes the resulting dataset larger, it also makes it less likely to lose information due to rounding error.

2. Create a 5mm sphere around the mask just created:

fslmaths ACCpoint.nii.gz -kernel sphere 5 -fmean ACCsphere -odt float

Explanation: The "-kernel sphere 5" creates the sphere. I am not sure about the "-fmean" option, but I believe it has something to do with determining whether voxels are assigned to the mask, depending on how much overlap there is with the sphere and the voxel.

3. Binarize the mask:

fslmaths ACCsphere.nii.gz -bin ACC_bin.nii.gz

Explanation: The -bin flag assigns a value of 1 to voxels inside the mask, and a value of 0 to voxels outside the mask.


Creating masks with any of the atlases included in FSL - e.g., the Harvard-Oxford Atlas, or the Juelich Histological Atlas - is done through the GUI, which is demonstrated in the video beginning at 6:00. Remember that in FSL these masks are probabilistic: the number contained in the voxel indicates the probability that the voxel belongs to that mask. In featquery, the extracted data can be weighted by these probabilities, or the mask can be binarized.

As you gain experience creating and using masks, you will become more comfortable using them in any situation: Combining masks, using masks to extract raw data and timecourses, and creating masks of different shapes and sizes, to name a few. As an exercise, try creating a mask of the left motor cortex by locating it on a template brain and drawing a 10mm sphere around it. Can you figure out how to remove voxels in the mask that happen to fall outside the brain? (You may need to refer to the last ROI video in AFNI for some ideas.) If you extract left button response parameters from this mask, what do you think they will look like? Positive? Negative? Approximately zero? Why? The more questions you ask yourself about why you are using a particular mask and what you expect to find within the mask, the more adept and confident you will become as a researcher.

← Extracting Timecourses with 3dmaskdumpABB Podcast #3: Ken Pugh (President, Haskins Laboratories) →
Archive
  • September 2024
  • June 2024
  • March 2024
  • January 2024
  • June 2023
  • May 2023
  • April 2023
  • February 2022
  • January 2022
  • January 2021
  • December 2020
  • April 2020
  • December 2018
  • April 2018
  • January 2018
  • December 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • January 2017
  • November 2016
  • August 2016
  • July 2016
  • February 2016
  • January 2016
  • September 2015
  • August 2015
  • July 2015
  • May 2015
  • April 2015
  • December 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • April 2012
  • March 2012

What's on Andy's Brain this month?

Connect with Andy!

Powered by Squarespace