Skip to content

Commit

Permalink
Merge pull request #1 from nilearn/master
Browse files Browse the repository at this point in the history
Merge origin/master
  • Loading branch information
Gilles86 authored Jul 11, 2018
2 parents 972b8c1 + a38485c commit 524f6a4
Show file tree
Hide file tree
Showing 29 changed files with 416 additions and 131 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ matrix:
SCIKIT_LEARN_VERSION="0.15"
# Fake Ubuntu Xenial (Travis doesn't support Xenial yet)
- env: DISTRIB="conda" PYTHON_VERSION="2.7"
NUMPY_VERSION="1.11" SCIPY_VERSION="0.17"
NUMPY_VERSION="1.11.2" SCIPY_VERSION="0.17"
SCIKIT_LEARN_VERSION="0.17"
NIBABEL_VERSION="2.0.2"
# Python 3.4 with intermediary versions
Expand Down
7 changes: 6 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
.. |connectome| image:: auto_examples/03_connectivity/images/sphx_glr_plot_inverse_covariance_connectome_004.png
:target: auto_examples/03_connectivity/plot_inverse_covariance_connectome.html

.. |surface_plot| image:: auto_examples/01_plotting/images/sphx_glr_plot_3d_map_to_surface_projection_001.png
:target: auto_examples/01_plotting/plot_3d_map_to_surface_projection.html

.. |haxby_weights| image:: auto_examples/images/sphx_glr_plot_decoding_tutorial_002.png
:target: auto_examples/plot_decoding_tutorial.html

Expand Down Expand Up @@ -58,7 +61,7 @@

* |glass_brain|

* |haxby_weights|
* |surface_plot|

* |oasis_weights|

Expand All @@ -70,6 +73,8 @@

* |tvl1_haxby|

* |haxby_weights|

* |searchlight|

.. raw:: html
Expand Down
2 changes: 1 addition & 1 deletion doc/modules/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ uses.
fetch_miyawaki2008
fetch_nyu_rest
fetch_surf_nki_enhanced
fetch_surf_fsaverage5
fetch_surf_fsaverage
fetch_atlas_surf_destrieux
fetch_atlas_talairach
fetch_oasis_vbm
Expand Down
4 changes: 2 additions & 2 deletions doc/themes/nilearn/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ <h2>Machine learning for Neuro-Imaging in Python</h2>

<h4> News </h4>
<ul>
<li><p> <strong>June 14th 2018</strong>: Nilearn 0.4.2 released
</p></li>
<li><p> <strong>March 12th 2018</strong>: Nilearn 0.4.1 released
</p></li>
<li><p> <strong>November 19th 2017</strong>: Nilearn 0.4 released
</p></li>
<li><p> <strong>June 20th 2017</strong>: Nilearn 0.3.1 released
</p></li>
<li><p> <strong>April 18th 2017</strong>: Nilearn 0.3.0 released
</p></li>
<li><p> <strong>March 2014</strong>: <a
href="http://journal.frontiersin.org/Journal/10.3389/fninf.2014.00014/abstract"
/>Paper</a> describing the concepts at the root of
Expand Down
50 changes: 49 additions & 1 deletion doc/whats_new.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
0.4.3
=====

Changes
-------

- `nilearn.datasets.fetch_surf_fsaverage5` is deprecated and will be
removed in a future release. Use :func:`nilearn.datasets.fetch_surf_fsaverage`,
with the parameter mesh="fsaverage5" (the default) instead.


Enhancements
------------

- Add :func:`nilearn.datasets.fetch_surf_fsaverage` to download either
fsaverage or fsaverage 5 (Freesurfer cortical meshes).


0.4.2
=====
Few important bugs fix release for OHBM conference.

Changes
-------
- Default colormaps for surface plotting functions have changed to be more
consistent with slice plotting.
:func:`nilearn.plotting.plot_surf_stat_map` now uses "cold_hot", as
:func:`nilearn.plotting.plot_stat_map` does, and
:func:`nilearn.plotting.plot_surf_roi` now uses "gist_ncar", as
:func:`nilearn.plotting.plot_roi` does.

- Improve 3D surface plotting: lock the aspect ratio of the plots and
reduce the whitespace around the plots.

Bug fixes
---------

- Fix bug with input repetition time (TR) which had no effect in signal
cleaning. Fixed by Pradeep Raamana.

- Fix issues with signal extraction on list of 3D images in
:class:`nilearn.regions.Parcellations`.

- Fix issues with raising AttributeError rather than HTTPError in datasets
fetching utilities. By Jerome Dockes.

- Fix issues in datasets testing function uncompression of files. By Pierre Glaser.

0.4.1
=====

Expand Down Expand Up @@ -328,7 +376,7 @@ Enhancements
- A function :func:`nilearn.plotting.plot_surf_roi` can be used for
plotting statistical maps rois onto brain surface.

- A function :func:`nilearn.datasets.fetch_surf_fsaverage5` can be used
- A function `nilearn.datasets.fetch_surf_fsaverage5` can be used
for surface data object to be as background map for the above plotting
functions.

Expand Down
23 changes: 20 additions & 3 deletions examples/01_plotting/plot_3d_map_to_surface_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Get a cortical mesh
# -------------------

fsaverage = datasets.fetch_surf_fsaverage5()
fsaverage = datasets.fetch_surf_fsaverage()

##############################################################################
# Sample the 3D data around each node of the mesh
Expand All @@ -41,8 +41,7 @@

plotting.plot_surf_stat_map(fsaverage.infl_right, texture, hemi='right',
title='Surface right hemisphere',
threshold=1., bg_map=fsaverage.sulc_right,
cmap='cold_hot')
threshold=1., bg_map=fsaverage.sulc_right)

##############################################################################
# Plot 3D image for comparison
Expand All @@ -54,4 +53,22 @@
plotting.plot_stat_map(localizer_tmap, display_mode='x', threshold=1.,
cut_coords=range(0, 51, 10), title='Slices')


##############################################################################
# Plot with higher-resolution mesh
# --------------------------------
#
# `fetch_surf_fsaverage` takes a "mesh" argument which specifies
# wether to fetch the low-resolution fsaverage5 mesh, or the high-resolution
# fsaverage mesh. using mesh="fsaverage" will result in more memory usage and
# computation time, but finer visualizations.

big_fsaverage = datasets.fetch_surf_fsaverage('fsaverage')
texture = surface.vol_to_surf(localizer_tmap, big_fsaverage.pial_right)

plotting.plot_surf_stat_map(big_fsaverage.infl_right, texture, hemi='right',
title='Surface right hemisphere: fine mesh',
threshold=1., bg_map=big_fsaverage.sulc_right)


plotting.show()
10 changes: 5 additions & 5 deletions examples/01_plotting/plot_surf_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# Retrieve fsaverage5 surface dataset for the plotting background. It contains
# the surface template as pial and inflated version and a sulcal depth maps
# which is used for shading
fsaverage = datasets.fetch_surf_fsaverage5()
fsaverage = datasets.fetch_surf_fsaverage()

# The fsaverage dataset contains file names pointing to the file locations
print('Fsaverage5 pial surface of left hemisphere is at: %s' %
Expand All @@ -55,26 +55,26 @@
plotting.plot_surf_roi(fsaverage['pial_left'], roi_map=parcellation,
hemi='left', view='lateral',
bg_map=fsaverage['sulc_left'], bg_on_data=True,
darkness=.5, cmap='gist_ncar')
darkness=.5)

###############################################################################
# Display Destrieux parcellation on inflated fsaverage5 surface
plotting.plot_surf_roi(fsaverage['infl_left'], roi_map=parcellation,
hemi='left', view='lateral',
bg_map=fsaverage['sulc_left'], bg_on_data=True,
darkness=.5, cmap='gist_ncar')
darkness=.5)

###############################################################################
# Display Destrieux parcellation with different views: posterior
plotting.plot_surf_roi(fsaverage['infl_left'], roi_map=parcellation,
hemi='left', view='posterior',
bg_map=fsaverage['sulc_left'], bg_on_data=True,
darkness=.5, cmap='gist_ncar')
darkness=.5)

###############################################################################
# Display Destrieux parcellation with different views: ventral
plotting.plot_surf_roi(fsaverage['infl_left'], roi_map=parcellation,
hemi='left', view='ventral',
bg_map=fsaverage['sulc_left'], bg_on_data=True,
darkness=.5, cmap='gist_ncar')
darkness=.5)
plotting.show()
2 changes: 1 addition & 1 deletion examples/01_plotting/plot_surf_stat_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
labels = destrieux_atlas['labels']

# Fsaverage5 surface template
fsaverage = datasets.fetch_surf_fsaverage5()
fsaverage = datasets.fetch_surf_fsaverage()

# The fsaverage dataset contains file names pointing to
# the file locations
Expand Down
10 changes: 7 additions & 3 deletions examples/02_decoding/plot_haxby_anova_svm.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@
condition_mask = behavioral['labels'].isin(['face', 'house'])
conditions = conditions[condition_mask]

# We now have 2 conditions
# Confirm that we now have 2 conditions
print(conditions.unique())
session = behavioral[condition_mask]

# Record these as an array of sessions, with fields
# for condition (face or house) and run
session = behavioral[condition_mask].to_records(index=False)
print(session.dtype.names)

#############################################################################
# Prepare the fMRI data: smooth and apply the mask
Expand Down Expand Up @@ -89,7 +93,7 @@
# Define the cross-validation scheme used for validation.
# Here we use a LeaveOneLabelOut cross-validation on the session label
# which corresponds to a leave-one-session-out
cv = LeaveOneLabelOut(session['chunks'])
cv = LeaveOneLabelOut(session)

# Compute the prediction accuracy for the different folds (i.e. session)
cv_scores = cross_val_score(anova_svc, X, conditions, cv=cv)
Expand Down
7 changes: 7 additions & 0 deletions nilearn/_utils/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
try:
from numpy import VisibleDeprecationWarning
except ImportError:
class VisibleDeprecationWarning(UserWarning):
pass


AuthorizedException = (
BufferError,
ArithmeticError,
Expand Down
4 changes: 3 additions & 1 deletion nilearn/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from .struct import (fetch_icbm152_2009, load_mni152_template,
load_mni152_brain_mask, fetch_oasis_vbm,
fetch_icbm152_brain_gm_mask,
MNI152_FILE_PATH, fetch_surf_fsaverage5)
MNI152_FILE_PATH, fetch_surf_fsaverage5,
fetch_surf_fsaverage)
from .func import (fetch_haxby_simple, fetch_haxby, fetch_nyu_rest,
fetch_adhd, fetch_miyawaki2008,
fetch_localizer_contrasts, fetch_abide_pcp,
Expand Down Expand Up @@ -41,6 +42,7 @@
'fetch_atlas_yeo_2011', 'fetch_mixed_gambles', 'fetch_atlas_aal',
'fetch_megatrawls_netmats', 'fetch_cobre',
'fetch_surf_nki_enhanced', 'fetch_surf_fsaverage5',
'fetch_surf_fsaverage',
'fetch_atlas_basc_multiscale_2015', 'fetch_coords_dosenbach_2010',
'fetch_neurovault', 'fetch_neurovault_ids',
'load_mni152_brain_mask', 'fetch_icbm152_brain_gm_mask',
Expand Down
21 changes: 21 additions & 0 deletions nilearn/datasets/description/fsaverage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
fsaverage


Notes
-----
Fsaverage standard surface as distributed with Freesurfer (Fischl et al, 1999)

Content
-------
:'pial_left': Gifti file, left hemisphere pial surface mesh
:'pial_right': Gifti file, right hemisphere pial surface mesh
:'infl_left': Gifti file, left hemisphere inflated pial surface mesh
:'infl_right': Gifti file, right hemisphere inflated pial
surface mesh
:'sulc_left': Gifti file, left hemisphere sulcal depth data
:'sulc_right': Gifti file, right hemisphere sulcal depth data

References
----------
Fischl et al, (1999). High-resolution intersubject averaging and a
coordinate system for the cortical surface. Hum Brain Mapp 8, 272-284.
8 changes: 5 additions & 3 deletions nilearn/datasets/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .._utils import check_niimg
from .._utils.compat import BytesIO, _basestring, _urllib
from .._utils.numpy_conversions import csv_to_array
from .._utils.exceptions import VisibleDeprecationWarning


@deprecated("fetch_haxby_simple will be removed in future releases. "
Expand Down Expand Up @@ -148,9 +149,10 @@ def fetch_haxby(data_dir=None, n_subjects=None, subjects=(2,),
The anatomical image for subject 6 is unavailable.
"""
if n_subjects is not None:
warnings.warn("The parameter 'n_subjects' is deprecated from 0.2.6 "
"and will be removed in nilearn next release. Use "
"parameter 'subjects' instead.")
warn_str = ("The parameter 'n_subjects' is deprecated from 0.2.6 and "
"will be removed in nilearn next release. Use parameter "
"'subjects' instead.")
warnings.warn(warn_str, VisibleDeprecationWarning, stacklevel=2)
subjects = n_subjects

if isinstance(subjects, numbers.Number) and subjects > 6:
Expand Down
Loading

0 comments on commit 524f6a4

Please sign in to comment.