How to Get Grey Matter Volume of Specific Brain Regions in SPM/MATLAB?

36 views (last 30 days)
I want to extract grey matter volume for specific regions (e.g., prefrontal cortex, amygdala) from MRI data that has been preprocessed. My lab gave me a code (see below) for calculating global grey matter volume (and white matter volume and CSF), but I am not sure whether I can adapt this script to also extract regional grey matter volume. Would appreciate help!
% Get total volumes in mm3
grey_totals(i) = get_totals ([data_path num2str(subnum) '/c1' num2str(subnum) '.nii']);
white_totals(i) = get_totals ([data_path num2str(subnum) '/c2' num2str(subnum) '.nii']);
csf_totals(i) = get_totals ([data_path num2str(subnum) '/c3' num2str(subnum) '.nii']);
end
  12 Comments
Karl
Karl on 19 Feb 2024
You're welcome! If you're unable to get the looping to work, please do submit another question, ideally including code and files for reproducing the problem (as you did in the comments here). Hopefully I, or someone else, will be able to help!

Sign in to comment.

Accepted Answer

Karl
Karl on 18 Feb 2024
Summarising from the comments, if 'roi.nii' is a NIfTI file containing a binary mask representing a region of interest (ROI), and the Statistical Parametric Mapping (SPM12) package is on the MATLAB path, the ROI volume can be calculated using the get_totals() function written by Ged Ridgway:
% Calculate ROI volume using SPM12.
roi_volume = get_totals('roi.nii');
The ROI volume can also be calculated without having SPM12 installed:
% Write example ROI (cuboid) in NIfTI format.
mask = zeros(100,100,100);
[x1, y1, z1] = deal(31, 41, 11);
[dx, dy, dz] = deal(40, 20, 80);
mask(x1:x1+dx-1,y1:y1+dy-1,z1:z1+dz-1) = 1;
niftiwrite(mask,'roi.nii')
% Read ROI from NIfTI file, and calculate its volume.
roi_info = niftiinfo('roi.nii');
roi = niftiread(roi_info);
roi_volume = sum(roi(:)) * prod(roi_info.PixelDimensions)
roi_volume = 64000
% Check that the calculated volume is as expected from the cuboid dimensions.
assert(roi_volume == dx * dy * dz)
Whichever method is used, the volume units should be checked.
  1 Comment
Arjun
Arjun on 25 Mar 2024
Just wanted to add on for future users that the CAT12 toolbox in SPM also provides estimates for each ROI based on selected atlases. This made it very easy for me to extract ROI values for both grey matter volume and cortical thickness!
You can read more in the CAT12 manual available here: https://neuro-jena.github.io/cat12-help/

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!