Previous topic

Using SPM’s CheckReg Tool

Next topic

Spatially restricting analyses

Creating an explicit mask

Sometimes you may want to create a binary mask of gray matter (or gray matter and white matter) to constrict analyses. Reasons for using a gray matter mask include ease of interpretation (i.e. excluding presumably false activations in ventricles, white matter, etc.) and reducing the number of voxelwise comparisons that are done, which may potentially increase your sensitivity to detecting true effects.

Keep in mind, though, that for cluster extent corrections that depend on random field theory, the smoothness of the data comes into play. The brain is fairly round (and thus a “smooth” shape), but a gray matter mask is not. Thus, cluster-extent corrections may actually be less sensitive when using a mask (though I’m not aware of this having been quantitatively evaluated). For most fMRI studies, the mask automatically generated by SPM during 1st-level model estimation works fairly well.

To create a gray matter mask for a single subject:

  1. Segment the structural image. If this is an fMRI study, make sure that the structural image is already coregistered with the functional images.
  2. To make a subject-space mask, you will use the c1* image (gray matter). To make a mask in MNI space, you will use the wc1* (unmodulated normalized) image.
  3. In ImCalc select the gray matter image. Each voxel has the probability of that voxel being gray matter; these range from near 0 to near 1, and so it’s impossible to perfectly select gray matter. If you choose a low threshold (e.g., .01), you will include a lot of voxels that are unlikely to be gray matter, but you won’t miss many true gray matter voxels. If you use a threshold like 0.99, you are likely to only be including gray matter voxels, but you will probably exclude a lot of voxels that are likely gray matter. As a rule of thumb a threshold in the neighborhood of 0.2 seems to work well. So as an expression, enter “i1>0.2”, and save the output image, which will be binary.
  4. If you are using the resulting mask to mask an analysis, it’s worth considering the amount of spatial smoothing that is done on the analyzed data. For example, in an fMRI study, you might be smoothing at 8 mm FWHM. Even if you have a perfect gray matter mask, this smoothing will push some signal outside the masked region. So, it may make sense to smooth the gray matter at the same level as your data. You could do this before thresholding, or after. If you do so after, then smooth the binary image, and re-threshold: having selected the smoothed binary image, use an ImCalc expression of “i1>0”, which will re-binarize your image. The mask will now be larger to reflect the additional smoothing. Obviously, in terms of mask size, the amount of smoothing and initial threshold will both influence the size, so you will need to decide what final result seems reasonable.
  5. If you want to do a gray matter + white matter mask, repeat this process for the white matter image (i.e., the c2* or wc2* image). To combine the gray matter and white matter masks, select both in ImCalc, and then use an expression like “(i1+i2)>0”.

For a group analysis, you could do the same thing, but on the mean of the segmented images:

  1. Create a mean normalized gray matter image by selecting all of the wc1* images in ImCalc.
  2. Select “read data as matrix”.
  3. For the expression, enter: “mean(X)”
  4. (Optionally, do the same for all of the wc2* white matter images.)
  5. Proceed as above with thresholding etc.

Alternately, if you have binary masks for each subject individually, you should be able to combine them at the group level using an ImCalc expression like “all(X)”.

Note that when passing an explicit mask to SPM during model estimation, it doesn’t have to be binary—SPM will analyze all voxels > 0. Sometimes keeping masks binary is more convenient, but it’s not necessary (i.e., you could use a smoothed binary image, rather than re-binarizing it). This is why it’s possible to use a thresholded statistic map (created using the “save” button after running results) as an explicit mask.