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

Surface plots #2477

Merged
merged 58 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
0201b22
Add plot_surf_montage
dangom Jan 20, 2019
78bec87
Fix float division by zero in Python 2 in plot_surf_montage
dangom Jan 21, 2019
ea0dd3f
Rename plot_surf_montage to plot_img_on_surf
dangom Jan 21, 2019
55fb7a7
Move _check_mesh from html_surface into check_mesh in surface.
dangom Jan 21, 2019
4d87ae9
Plot_img_on_surf now uses check_mesh
dangom Jan 21, 2019
d334693
Improve handling of keyword args in plot_img_on_surf
dangom Jan 21, 2019
867a01e
Factor out plot_img_on_surf's colorbar code into a helper function
dangom Jan 21, 2019
983745b
Improve docs related to surf_mesh
dangom Jan 21, 2019
f31bd3c
Move cmap to a keyword argument in plot_img_on_surf
dangom Jan 21, 2019
f32e614
Fix plot_img_on_surf surf_mesh default. From None to fsaverage5
dangom Jan 21, 2019
1ce4aad
Add more tests.
dangom Jan 21, 2019
e4e7a9e
Update examples/01_plotting/plot_img_on_surf.py
jeromedockes Jan 22, 2019
1388051
Update examples/01_plotting/plot_img_on_surf.py
jeromedockes Jan 22, 2019
31a7991
Move plot_img_on_surf example to plot_3d_map_to_surface_projection
dangom Jan 23, 2019
648fa94
Remove unused import in surf_plotting.py
dangom Jan 23, 2019
7bdd9c1
Make 'cold_hot' the default cmap in plot_img_on_surf
dangom Jan 23, 2019
2dc314f
Use safeguard check_niimg_3d to plot_img_on_surf
dangom Jan 23, 2019
35e30c3
Merged latest master into @dangom's/surf_montage.
ZviBaratz May 21, 2020
66c2a47
Fixed surface module's tests.
ZviBaratz May 21, 2020
14fac1a
Fixed the test failure. It was caused by a line I missed in the merge.
ZviBaratz May 21, 2020
e2dd639
Merged upstream and added examples artifacts to gitignore.
ZviBaratz May 29, 2020
1a50359
Added plot_img_on_surf() to reference.rst and made tiny styling fixes…
ZviBaratz May 29, 2020
fc0aaa1
Added a What's New entry for plot_img_on_surf().
ZviBaratz May 29, 2020
63129da
Added some missing tests for plot_img_on_surf().
ZviBaratz May 29, 2020
05d2510
Changed relative imports to absolute imports in surf_plotting.py.
ZviBaratz May 29, 2020
a1895fc
Merge branch 'master' into surface_plots
ZviBaratz Jun 1, 2020
a62f0fc
Merged master and edited plot_img_on_surf() docstring to fix RST inde…
ZviBaratz Jun 1, 2020
5eaad19
Another round with Sphinx.
ZviBaratz Jun 1, 2020
d4cb770
Updated test surface fetch method and resolved linting issues.
ZviBaratz Jun 1, 2020
74c016e
Fixed to conform with the default flake8 max-line-length configuration.
ZviBaratz Jun 1, 2020
d4c1a88
Sphinx U+1F3F3
ZviBaratz Jun 1, 2020
c0c4f58
Added .vscode to gitignore and organized a bit.
ZviBaratz Jun 2, 2020
56de47c
Changed test_plot_img_on_surf_output_file() in attempt to solve build…
ZviBaratz Jun 2, 2020
6db1144
Merge branch 'master' into surface_plots
ZviBaratz Jun 6, 2020
e3e993b
Fixed horizontal squeeze by adding an aspect_ratio parameter to plot_…
ZviBaratz Jun 7, 2020
7f55423
Fixed bad :func: directive in plot_img_on_surf() example.
ZviBaratz Jun 7, 2020
962e13f
Update examples/01_plotting/plot_3d_map_to_surface_projection.py
ZviBaratz Jun 9, 2020
ebb7e6f
Removed length check from `_check_hemisphere()`
ZviBaratz Jun 9, 2020
e95c882
Proposed Orientation Enum for surface plotting configuration.
ZviBaratz Jun 9, 2020
c150fdf
Updated example to comply with changing the display_mode parameter to…
ZviBaratz Jun 9, 2020
d218a82
Reverted Enum creation and updated plot_img_on_surf's hemispheres par…
ZviBaratz Jun 9, 2020
bb118d7
Reverted changes to gitignore.
ZviBaratz Jun 10, 2020
942fa0f
Removed obj domain referencing in docstrings.
ZviBaratz Jun 10, 2020
3034054
Removed f-strings to maintain python 3.5 compatibility.
ZviBaratz Jun 10, 2020
1c617f2
Fixed missed f-strings.
ZviBaratz Jun 10, 2020
f6ccb9f
Fixed error message strings in _check_views() and _check_hemispheres().
ZviBaratz Jun 10, 2020
03a2e78
Reverted image module docstring fixes.
ZviBaratz Jun 25, 2020
9ede345
Made check_mesh() private.
ZviBaratz Jun 25, 2020
b357672
Reverted img_plotting module docstring fixes.
ZviBaratz Jun 25, 2020
da9d243
Removed list conversion in _check_hemispehres() and _check_views() an…
ZviBaratz Jun 25, 2020
44646f4
Made 'fsaverage5' plot_img_on_surf()'s default surf_mesh value and up…
ZviBaratz Jun 25, 2020
ac23a61
Added a try-except block to remove plot_img_on_surf()'s output file a…
ZviBaratz Jun 25, 2020
3c84edc
Changed test_plot_img_on_surf_output_file() to use pytest's tmp_path …
ZviBaratz Jun 25, 2020
5f5d3e8
Fixed plot_img_on_surf()'s aspect ratio parameter to default to 1.4 a…
ZviBaratz Jun 25, 2020
9f8fbc6
Removed symmetric_cbar parameter from plot_img_on_surf().
ZviBaratz Jun 25, 2020
52794d6
Removed symmetric_cbar parameter from _colorbar_from_array().
ZviBaratz Jun 25, 2020
d7daa31
Reverted changes to the image.py module.
ZviBaratz Jun 30, 2020
6feb6ba
Merged changes from master.
ZviBaratz Jun 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ tags
venv/

doc/themes/nilearn/static/jquery.js
.vscode/
examples/results/
examples/**/*.pdf
1 change: 1 addition & 0 deletions doc/modules/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ the :ref:`user guide <user_guide>` for more information and usage examples.
plot_surf_roi
plot_surf_contours
plot_surf_stat_map
plot_img_on_surf
view_surf
view_img_on_surf
view_connectome
Expand Down
10 changes: 6 additions & 4 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ NEW
as a "Power plot" or a "grayplot"), for visualizing global patterns in
4D functional data over time.
- New plotting function
:func:`nilearn.plotting.plot_markers` shows network nodes (markers) on a glass
:func:`nilearn.plotting.plot_img_on_surf` generates multiple views of
:func:`nilearn.plotting.plot_surf_stat_map` in a single figure.
- :func:`nilearn.plotting.plot_markers` shows network nodes (markers) on a glass
brain template and color code them according to provided nodal measure (i.e.
connection strength). This function will replace
:func:`nilearn.plotting.plot_connectome_strength`.
Expand Down Expand Up @@ -354,7 +356,7 @@ NEW
when using the `mask_strategy="template"` option for brains in MNI space.
- New brain development fMRI dataset fetcher
:func:`nilearn.datasets.fetch_development_fmri` can be used to download
movie-watching data in children and adults; a light-weight dataset
movie-watching data in children and adults; a light-weight dataset
implemented for teaching and usage in the examples.
- New example in `examples/05_advanced/plot_age_group_prediction_cross_val.py`
to compare methods for classifying subjects into age groups based on
Expand All @@ -377,8 +379,8 @@ Changes

- All the connectivity examples are changed from ADHD to brain development
fmri dataset.
- Examples plot_decoding_tutorial, plot_haxby_decoder,
ZviBaratz marked this conversation as resolved.
Show resolved Hide resolved
plot_haxby_different_estimators, plot_haxby_full_analysis, plot_oasis_vbm now
- Examples plot_decoding_tutorial, plot_haxby_decoder,
plot_haxby_different_estimators, plot_haxby_full_analysis, plot_oasis_vbm now
use :class:`nilearn.decoding.Decoder` and :class:`nilearn.decoding.DecoderRegressor`
instead of sklearn SVC and SVR.

Expand Down
15 changes: 14 additions & 1 deletion examples/01_plotting/plot_3d_map_to_surface_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,22 @@
threshold=1., bg_map=big_fsaverage.sulc_right)


##############################################################################
# Plot multiple views of the 3D volume on a surface
# -------------------------------------------------
#
# *plot_img_on_surf* takes a statistical map and projects it onto a surface.
# It supports multiple choices of orientations, and can plot either one or both
# hemispheres. If no *surf_mesh* is given, *plot_img_on_surf* projects the
# images onto `FreeSurfer <https://surfer.nmr.mgh.harvard.edu/>`_\'s
# fsaverage5.

plotting.plot_img_on_surf(stat_img,
views=['lateral', 'medial'],
hemispheres=['left', 'right'],
colorbar=True)
plotting.show()


##############################################################################
# 3D visualization in a web browser
# ---------------------------------
Expand Down
9 changes: 5 additions & 4 deletions nilearn/plotting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ def _set_mpl_backend():
from .html_stat_map import view_img
from .html_connectome import view_connectome, view_markers
from .surf_plotting import (plot_surf, plot_surf_stat_map, plot_surf_roi,
plot_surf_contours)
plot_img_on_surf, plot_surf_contours)

__all__ = ['cm', 'plot_img', 'plot_anat', 'plot_epi',
'plot_roi', 'plot_stat_map', 'plot_glass_brain',
'plot_markers', 'plot_connectome', 'plot_prob_atlas',
'find_xyz_cut_coords', 'find_cut_slices',
'show', 'plot_matrix', 'view_surf', 'view_img_on_surf',
'view_img', 'view_connectome', 'view_markers',
'find_parcellation_cut_coords', 'find_probabilistic_atlas_cut_coords',
'find_parcellation_cut_coords',
'find_probabilistic_atlas_cut_coords',
'plot_surf', 'plot_surf_stat_map', 'plot_surf_roi',
'plot_connectome_strength', 'plot_carpet', 'plot_surf_contours'
]
'plot_img_on_surf', 'plot_connectome_strength', 'plot_carpet',
'plot_surf_contours']
11 changes: 6 additions & 5 deletions nilearn/plotting/html_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import matplotlib as mpl
from matplotlib import cm as mpl_cm

from .._utils.niimg_conversions import check_niimg_3d
from .. import datasets, surface
from nilearn._utils.niimg_conversions import check_niimg_3d
from nilearn import surface
from nilearn import datasets
from nilearn.reporting import HTMLDocument
from . import cm
from .js_plotting_utils import (
from nilearn.plotting import cm
from nilearn.plotting.js_plotting_utils import (
colorscale, mesh_to_plotly, get_html_template, add_js_lib,
to_color_strings)

Expand Down Expand Up @@ -91,7 +92,7 @@ def full_brain_info(volume_img, mesh='fsaverage5', threshold=None,

"""
info = {}
mesh = _check_mesh(mesh)
mesh = surface.surface._check_mesh(mesh)
surface_maps = {
h: surface.vol_to_surf(volume_img, mesh['pial_{}'.format(h)],
**vol_to_surf_kwargs)
Expand Down