9.6.4. Voxel-Based Morphometry on Oasis dataset¶
This example uses Voxel-Based Morphometry (VBM) to study the relationship between aging, sex and gray matter density.
The data come from the OASIS project. If you use it, you need to agree with the data usage agreement available on the website.
It has been run through a standard VBM pipeline (using SPM8 and NewSegment) to create VBM maps, which we study here.
184.108.40.206. VBM analysis of aging¶
We run a standard GLM analysis to study the association between age and gray matter density from the VBM data. We use only 100 subjects from the OASIS dataset to limit the memory usage.
Note that more power would be obtained from using a larger sample of subjects.
# Authors: Bertrand Thirion, <firstname.lastname@example.org>, July 2018 # Elvis Dhomatob, <email@example.com>, Apr. 2014 # Virgile Fritsch, <firstname.lastname@example.org>, Apr 2014 # Gael Varoquaux, Apr 2014 n_subjects = 100 # more subjects requires more memory
220.127.116.11. Load Oasis dataset¶
/home/nicolas/anaconda3/envs/nilearn/lib/python3.8/site-packages/numpy/lib/npyio.py:2405: VisibleDeprecationWarning: Reading unicode strings without specifying the encoding argument is deprecated. Set the encoding, use None for the system default. output = genfromtxt(fname, **kwargs)
Sex is encoded as ‘M’ or ‘F’. Hence, we make it a binary variable.
Print basic information on the dataset.
First gray-matter anatomy image (3D) is located at: /home/nicolas/nilearn_data/oasis1/OAS1_0001_MR1/mwrc1OAS1_0001_MR1_mpr_anon_fslswapdim_bet.nii.gz First white-matter anatomy image (3D) is located at: /home/nicolas/nilearn_data/oasis1/OAS1_0001_MR1/mwrc2OAS1_0001_MR1_mpr_anon_fslswapdim_bet.nii.gz
Get a mask image: A mask of the cortex of the ICBM template.
Resample the images, since this mask has a different resolution.
18.104.22.168. Analyse data¶
First, we create an adequate design matrix with three columns: ‘age’, ‘sex’, ‘intercept’.
Let’s plot the design matrix.
Text(29.000000000000007, 0.5, 'maps')
Next, we specify and fit the second-level model when loading the data and also smooth a little bit to improve statistical behavior.
SecondLevelModel(mask_img=<nibabel.nifti1.Nifti1Image object at 0x7f4e68015bb0>, smoothing_fwhm=2.0)
Estimating the contrast is very simple. We can just provide the column name of the design matrix.
We threshold the second level contrast at uncorrected p < 0.001 and plot it.
from nilearn import plotting from nilearn.glm import threshold_stats_img _, threshold = threshold_stats_img( z_map, alpha=.05, height_control='fdr') print('The FDR=.05-corrected threshold is: %.3g' % threshold) display = plotting.plot_stat_map( z_map, threshold=threshold, colorbar=True, display_mode='z', cut_coords=[-4, 26], title='age effect on grey matter density (FDR = .05)') plotting.show()
The FDR=.05-corrected threshold is: 2.4
We can also study the effect of sex by computing the contrast, thresholding it and plot the resulting map.
<nilearn.plotting.displays.OrthoSlicer object at 0x7f4e681947c0>
Note that there does not seem to be any significant effect of sex on grey matter density on that dataset.
22.214.171.124. Generating a report¶
It can be useful to quickly generate a portable, ready-to-view report with most of the pertinent information. This is easy to do if you have a fitted model and the list of contrasts, which we do here.
We have several ways to access the report:
# report # This report can be viewed in a notebook # report.save_as_html('report.html') # report.open_in_browser()
Total running time of the script: ( 2 minutes 16.529 seconds)