We can calculate grey/white matter volume from segmented images.
You need the following script and SPM plugin.
- WFU PickAtlas
A script written by Ged Ridgway. You can get this script from http://www0.cs.ucl.ac.uk/staff/g.ridgway/vbm/get_totals.m. (Right click and save the script in SPM directory or any directory you set matlab path.)
With PickAtlas, you can create ROI mask easily. You can get this plugin from
As of images, I recommend using the segmented image by VBM8. Note that you need to do modulation of the option “affine + non-linear (SPM8 default).” The grey matter image generated by VBM8 should look like mwrp1xxx.nii.
First, let’s get the total grey matter volume.
Type the following from Matlab command window.
The dialog pops out to choose images. Select the grey matter images you want to know the volume.
Then, the volume appears in Matlab window.
<li>Calculate regional volume</li>
By defining ROI mask, you can get the regional volume within mask.
Here, we would like to get the GM volume of left hemisphere.
Type the following in Matlab window.
You get the following message.
get_totals – Returns image totals (sum over all voxels), in ml
t = get_totals
[t files] = get_totals(files, thr, msk)
GUI file-selection is used if files not specified as argument (or empty).
Point is get_totals(files, thr, msk). You can specify threshold or mask images. However, entering these files manually is annoying, so we specify , which leads to pop up the GUI file selection dialogue.
- prepare mask images
- Change the voxel size of the mask image
- Calculate GM volume of left hemisphere using get_totals
We make mask image using WFU PickAtlas. Start PickAtlas by selecting pickatlas from SPM8 toolbox.
Now We would like to generate mask of lt. hemisphere. So We choose “TD Hemispheres” on the left panel of the window, and double-click Left Brainstem, Left Cerebellum, and Left Cereberum. These regions should be moved to the right panel (Working Region 1)
Then click “SAVE MASK” and save mask image. I named it lt_hemisphere.nii.
You can display mask image using SPM display function. Note that the voxel size of the mask is 2x2x2.
As we saw in SPM Display, the voxel dimension of mas images generated by PickAtlas is 2x2x2. However, the voxel dimension of segmented image using DARTEL is 1.5×1.5×1.5. Since voxel dimension is different between two, we cannot do multiplication of the images. So we need to change the voxel size of the mask image. We use “Coregister (Reslice)” to achieve this.
Select “Coregister (Reslice)” on SPM menu.
Then, a window like below appears.
Specify grey matter image as “Image Defining Space.”
Specify mask image as “Images to Reslice.”
Set the Interpolation to Nearest neighbour so that the resliced mask remains binary.
You can leave other parameters as default.
Then you will get the new mask file with prefix “r”. This time the file should be rlt_hemisphere.nii.
Display this file with SPM8 and this time the voxel size is -1.5 x 1.5 x 1.5.
Now type the following in Matlab window.
This will pop up the dialog to choose GM images.
Next, another dialog pops up. This time select mask images, i.e., rlt_hemisphere.nii this time.
Threshold is set to 0 if it is blank. If you want to calculate volumes with the signal >=0.1, you set 0.1 instead of .
Then, you’ll get the following in Matlab window.
We see the value is almost half of the total grey matter volume.
That’s it. I thank Ged Ridgway for his advice.