# Brainhack 2013

This year, Brainhack unconference has been held in CIEP in Paris. The goal of (un)conference is to gather scientists studying brain around 3 day projects. During this hackathon, I had the occasion to work on nilearn, the framework I worked on when I was an engineer in Neurospin. I have obviously chose to work on subjects that are directly linked with my thesis and I will integrate the code I made during this conference in my experiments very soon.

My work was done in collaboration with Solveig Badillo, another member of the Parietal and soon-to-be PhD.

*Parietal team @ Brainhack ! From left to right: Elvis Dohmatob, Solveig
Badillo and me*

Gael Varoquaux worked on his own on nilearn documentation and he did some nilearn evanglism (or consulting, as he said)

# A whole brain fMRI atlas generated via spatially constrained spectral clustering

Our work consisted in reproducing the results from an article written by Craddock et al in 2012: A whole brain fMRI atlas generated via spatially constrained spectral clustering. These results should enrich the nilearn framework and be reproducibles in a simple example.

## Applying spectral clustering to fMRI resting state data

Spectral clustering uses a N-cut approach to cluster nodes from a graph. To build the graph corresponding to our fMRI data, we build a graph where each voxel is connected to its neighbours. On the edges of the graph, we put a Pearson correlation coefficient between the voxels. Two approaches are used in the original paper:

- Temporal correlation
*rt* - Spatial correlation
*rs*

In the original work, a 26-neighbour connectivity was used. As our code is based on the scikit-learn, we had to comply with its builtin graph connectivity which is a 6-neighbour connectivity. This difference has lead to the difference between the figure below and the original one: our graph has far less edges, so the figure has less points.

We reproduced a picture from the original work showing the agreement between the two correlation metrics. Our version really looks alike the original one.

*Agreement between temporal and spatial correlation coefficients.*

## Group level clustering

Cameron Craddock tried two ways to add a group level to his clustering:

- Average the similarity matrices (ie the graphs) between all subjects before applying spectral clustering
- Run the clustering for each subjects and then average the similarity matrices computed out of these clusterings. Spectral clustering is then applied again on the resulting matrix.

The stability of the methods was measured using the DICE coefficient using a one-versus-all strategy. The figure below represents dice coefficients for different number of clusters using temporal correlation and the first group strategy. More computations are needed to make a full study of the different methods.

*Stability (DICE coefficient) depending on the number of clusters.*

Here are two brain clusterings obtained using temporal correlation. They look very similar because Craddock test dataset is only composed of 3 subjects.

*Clustering obtains using temporal correlation and the two group methods.
Left: first group strategy. Right: second group strategy.*

This example will been available in nilearn.

Back to blog