8.4.1. Group analysis of resting-state fMRI with ICA: CanICAΒΆ

An example applying CanICA to resting-state data. This example applies it to 30 subjects of the ADHD200 datasets. Then it plots a map with all the components together and an axial cut for each of the components separately.

CanICA is an ICA method for group-level analysis of fMRI data. Compared to other strategies, it brings a well-controlled group model, as well as a thresholding algorithm controlling for specificity and sensitivity with an explicit model of the signal. The reference papers are:

  • G. Varoquaux et al. “A group model for stable multi-subject ICA on fMRI datasets”, NeuroImage Vol 51 (2010), p. 288-299
  • G. Varoquaux et al. “ICA-based sparse features recovery from fMRI datasets”, IEEE ISBI 2010, p. 1177

Pre-prints for both papers are available on hal (http://hal.archives-ouvertes.fr)

First we load the ADHD200 data

from nilearn import datasets

adhd_dataset = datasets.fetch_adhd(n_subjects=30)
func_filenames = adhd_dataset.func  # list of 4D nifti files for each subject

# print basic information on the dataset
print('First functional nifti image (4D) is at: %s' %
      func_filenames[0])  # 4D data

Out:

First functional nifti image (4D) is at: /home/kamalakar/nilearn_data/adhd/data/0010042/0010042_rest_tshift_RPI_voreg_mni.nii.gz

Here we apply CanICA on the data

from nilearn.decomposition import CanICA

canica = CanICA(n_components=20, smoothing_fwhm=6.,
                memory="nilearn_cache", memory_level=2,
                threshold=3., verbose=10, random_state=0)
canica.fit(func_filenames)

# Retrieve the independent components in brain space
components_img = canica.masker_.inverse_transform(canica.components_)
# components_img is a Nifti Image object, and can be saved to a file with
# the following line:
components_img.to_filename('canica_resting_state.nii.gz')

Out:

[MultiNiftiMasker.fit] Loading data from [/home/kamalakar/nilearn_data/adhd/data/0010042/0010042_rest_tshift_RPI_voreg_mni.nii.gz, /home/kamalakar/nilearn_data/adhd/data/0010064/0010064_rest_tshift_RPI_voreg_mni.nii.gz, /home/kamalakar/nilea
[MultiNiftiMasker.fit] Computing mask
[MultiNiftiMasker.transform] Resampling mask
[Memory]    0.5s, 0.0min: Loading randomized_svd from nilearn_cache/joblib/sklearn/utils/extmath/randomized_svd/b457e6449902294fedf8b3d4f3331c31
______________________________________randomized_svd cache loaded - 0.0s, 0.0min
[Memory]    0.6s, 0.0min: Loading fastica from nilearn_cache/joblib/sklearn/decomposition/fastica_/fastica/fdf1f7bd641d94e9a531c8180af98ba3
_____________________________________________fastica cache loaded - 0.0s, 0.0min
[Memory]    0.6s, 0.0min: Loading fastica from nilearn_cache/joblib/sklearn/decomposition/fastica_/fastica/88582b5807c98d0423355d64cb8b30bc
_____________________________________________fastica cache loaded - 0.0s, 0.0min
[Memory]    0.6s, 0.0min: Loading fastica from nilearn_cache/joblib/sklearn/decomposition/fastica_/fastica/cdba630e5f809380c51dbee77000b505
_____________________________________________fastica cache loaded - 0.0s, 0.0min
[Memory]    0.7s, 0.0min: Loading fastica from nilearn_cache/joblib/sklearn/decomposition/fastica_/fastica/a0f57d4b4f63ea561cfc18855d48db02
_____________________________________________fastica cache loaded - 0.0s, 0.0min
[Memory]    0.7s, 0.0min: Loading fastica from nilearn_cache/joblib/sklearn/decomposition/fastica_/fastica/8e39d4464b06848c691881bee8308212
_____________________________________________fastica cache loaded - 0.0s, 0.0min
[Memory]    0.8s, 0.0min: Loading fastica from nilearn_cache/joblib/sklearn/decomposition/fastica_/fastica/93cfac7822c926b42b2f9a357dd08402
_____________________________________________fastica cache loaded - 0.0s, 0.0min
[Memory]    0.8s, 0.0min: Loading fastica from nilearn_cache/joblib/sklearn/decomposition/fastica_/fastica/aab10f22ba209f1fae8015c7fb6c5e67
_____________________________________________fastica cache loaded - 0.0s, 0.0min
[Memory]    0.8s, 0.0min: Loading fastica from nilearn_cache/joblib/sklearn/decomposition/fastica_/fastica/6e0ceb6dc4aa2b20f042e8d5837ece42
_____________________________________________fastica cache loaded - 0.0s, 0.0min
[Memory]    0.9s, 0.0min: Loading fastica from nilearn_cache/joblib/sklearn/decomposition/fastica_/fastica/93c16a7ac183d4c57ac6374b08accc9c
_____________________________________________fastica cache loaded - 0.0s, 0.0min
[Memory]    0.9s, 0.0min: Loading fastica from nilearn_cache/joblib/sklearn/decomposition/fastica_/fastica/b026874f8cf4696ce4f65637d0b82795
_____________________________________________fastica cache loaded - 0.0s, 0.0min

To visualize we plot the outline of all components on one figure

from nilearn.plotting import plot_prob_atlas

# Plot all ICA components together
plot_prob_atlas(components_img, title='All ICA components')
../../_images/sphx_glr_plot_canica_resting_state_001.png

Finally, we plot the map for each ICA component separately

from nilearn.image import iter_img
from nilearn.plotting import plot_stat_map, show

for i, cur_img in enumerate(iter_img(components_img)):
    plot_stat_map(cur_img, display_mode="z", title="IC %d" % i,
                  cut_coords=1, colorbar=False)

show()
  • ../../_images/sphx_glr_plot_canica_resting_state_002.png
  • ../../_images/sphx_glr_plot_canica_resting_state_003.png
  • ../../_images/sphx_glr_plot_canica_resting_state_004.png
  • ../../_images/sphx_glr_plot_canica_resting_state_005.png
  • ../../_images/sphx_glr_plot_canica_resting_state_006.png
  • ../../_images/sphx_glr_plot_canica_resting_state_007.png
  • ../../_images/sphx_glr_plot_canica_resting_state_008.png
  • ../../_images/sphx_glr_plot_canica_resting_state_009.png
  • ../../_images/sphx_glr_plot_canica_resting_state_010.png
  • ../../_images/sphx_glr_plot_canica_resting_state_011.png
  • ../../_images/sphx_glr_plot_canica_resting_state_012.png
  • ../../_images/sphx_glr_plot_canica_resting_state_013.png
  • ../../_images/sphx_glr_plot_canica_resting_state_014.png
  • ../../_images/sphx_glr_plot_canica_resting_state_015.png
  • ../../_images/sphx_glr_plot_canica_resting_state_016.png
  • ../../_images/sphx_glr_plot_canica_resting_state_017.png
  • ../../_images/sphx_glr_plot_canica_resting_state_018.png
  • ../../_images/sphx_glr_plot_canica_resting_state_019.png
  • ../../_images/sphx_glr_plot_canica_resting_state_020.png
  • ../../_images/sphx_glr_plot_canica_resting_state_021.png

Total running time of the script: ( 0 minutes 59.870 seconds)

Generated by Sphinx-Gallery