"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.\n",
"\n",
"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.\n",
"\n",
"It comprises 10 preprocessed resting-state fMRI selected from 72 patients diagnosed with schizophrenia and 74 healthy controls (6mm isotropic, TR=2s, 150 volumes).\n",
"\n",
"* [Download the data](#download-the-data)\n",
"* [Clean the data](#clean-the-data)\n",
"* [Run `melodic`](#run-melodic)\n",
"\n",
"Firstly we will import the necessary packages for this notebook: "
"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",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Create a list of filenames for cleaned and smoothed data\n",
"clean = [f.replace('.nii.gz', '_clean.nii.gz') for f in d.func]\n",
"smooth = [f.replace('.nii.gz', '_clean_smooth.nii.gz') for f in d.func]\n",
"\n",
"# loop through each subject, regress confounds and smooth\n",
"for img, cleaned, smoothed, conf in zip(d.func, clean, smooth, d.confounds):\n",
"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```):"
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)
Firstly we will import the necessary packages for this notebook:
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
# Create a directory in the users home directory to store the downloaded data
data_dir=op.expanduser('~/nilearn_data')
ifnotop.exists(data_dir):
os.makedirs(data_dir)
# Download the data (if not already downloaded)
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```):