This notebook will download an open fMRI dataset (~50MB) for use in the MIGP demo. It also regresses confounds from the data and performs spatial smoothing with 10mm FWHM.
This data is a derivative from the COBRE sample found in the International Neuroimaging Data-sharing Initiative (http://fcon_1000.projects.nitrc.org/indi/retro/cobre.html), originally released under Creative Commons - Attribution Non-Commercial.
It comprises 10 preprocessed resting-state fMRI selected from 72 patients diagnosed with schizophrenia and 74 healthy controls (6mm isotropic, TR=2s, 150 volumes).
*[Download the data](#download-the-data)
*[Clean the data](#clean-the-data)
*[Run `melodic`](#run-melodic)
*[Plot group ICs](#plot-group-ics)
Firstly we will import the necessary packages for this notebook:
Create a directory in the users home directory to store the downloaded data:
`expanduser` will expand the `~` to the be users home directory:
%% Cell type:code id: tags:
``` python
data_dir=op.expanduser('~/nilearn_data')
ifnotop.exists(data_dir):
os.makedirs(data_dir)
```
%% Cell type:markdown id: tags:
Download the data (if not already downloaded). We use a method from [`nilearn`](https://nilearn.github.io/index.html) called `fetch_cobre` to download the fMRI data:
%% Cell type:code id: tags:
``` python
d=datasets.fetch_cobre(data_dir=data_dir)
```
%% Cell type:markdown id: tags:
<aclass="anchor"id="clean-the-data"></a>
## Clean the data
We use methods from [`nilearn`](https://nilearn.github.io/index.html) to regress confounds from the data (```clean_img```) and to spatially smooth the data with a gaussian filter of 10mm FWHM (```smooth_img```):
%% Cell type:code id: tags:
``` python
# Create a list of filenames for cleaned and smoothed data
To run ```melodic``` we will need a brain mask in MNI152 space at the same resolution as the fMRI. Here we use [`nilearn`](https://nilearn.github.io/index.html) methods to load the MNI152 mask (```load_mni152_brain_mask```), resample to the resolution of the fMRI (```resample_to_img```), and binarize (```math_img```):