Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Removed sub-example due to unfit for lasso dataset - unstable float values #2177

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ Changes
- :func:`nilearn.plotting.view_connectome` now converts NaNs in the adjacency
matrix to 0.

- Removed the plotting connectomes example which used the Seitzman atlas
from `examples/03_connectivity/plot_sphere_based_connectome.py`.
The atlas data is unsuitable for the method & the example is redundant.

Fixes
-----

Expand Down
58 changes: 2 additions & 56 deletions examples/03_connectivity/plot_sphere_based_connectome.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

This example shows how to extract signals from spherical regions.
We show how to build spheres around user-defined coordinates, as well as
centered on coordinates from the Power-264 atlas [1], the Dosenbach-160
atlas [2], and the Seitzman-300 atlas [3].
centered on coordinates from the Power-264 atlas [1], and the Dosenbach-160
atlas [2].

**References**

Expand All @@ -15,11 +15,6 @@
[2] Dosenbach N.U., Nardos B., et al. "Prediction of individual brain maturity
using fMRI.", 2010, Science 329, 1358-1361.

[3] `Seitzman, B. A., et al. "A set of functionally-defined brain regions with
improved representation of the subcortex and cerebellum.", 2018, bioRxiv,
450452
<http://doi.org/10.1101/450452>`_

We estimate connectomes using two different methods: **sparse inverse
covariance** and **partial_correlation**, to recover the functional brain
**networks structure**.
Expand Down Expand Up @@ -332,55 +327,6 @@

plotting.show()


###############################################################################
# Connectome extracted from Seitzman's atlas
# -----------------------------------------------------
# We repeat the same steps for Seitzman's atlas.
seitzman = datasets.fetch_coords_seitzman_2018()

coords = np.vstack((
seitzman.rois['x'],
seitzman.rois['y'],
seitzman.rois['z'],
)).T

###############################################################################
# Before calculating the connectivity matrix, let's look at the distribution
# of the regions of the default mode network.
dmn_rois = seitzman.networks == "DefaultMode"
dmn_coords = coords[dmn_rois]
zero_matrix = np.zeros((len(dmn_coords), len(dmn_coords)))
plotting.plot_connectome(zero_matrix, dmn_coords,
title='Seitzman default mode network',
node_color='darkred', node_size=20)

###############################################################################
# Now let's calculate connectivity for the Seitzman atlas.
spheres_masker = input_data.NiftiSpheresMasker(
seeds=coords, smoothing_fwhm=6, radius=4,
detrend=True, standardize=True, low_pass=0.1, high_pass=0.01, t_r=2,
allow_overlap=True)

timeseries = spheres_masker.fit_transform(func_filename,
confounds=confounds_filename)

covariance_estimator = GraphicalLassoCV()
covariance_estimator.fit(timeseries)
matrix = covariance_estimator.covariance_

plotting.plot_matrix(matrix, vmin=-1., vmax=1., colorbar=True,
title='Seitzman correlation matrix')

plotting.plot_connectome(matrix, coords, title='Seitzman correlation graph',
edge_threshold="99.7%", node_size=20, colorbar=True)


###############################################################################
# We can easily identify the networks from the matrix blocks.
print('Seitzman networks names are {0}'.format(np.unique(seitzman.networks)))
plotting.show()

###############################################################################
# .. seealso::
#
Expand Down