Plot a whole brain using plotting.plot_surf_stat_map

Is there any way to plot a whole brain using plotting.plot_surf_stat_map?
I only see hemi {‘left’, ‘right’}, not “both”.
Thank you.

you can using plot_img_on_surf: Making a surface plot of a 3D statistical map - Nilearn

1 Like

is there any way to just show one big brain and be able to rotate it? Seems these are four static plots.

Hi @AdelleBernal,

You may find this Brain visualization template helpful: https://sidchop.shinyapps.io/braincode/

Best,
Steven

2 Likes

In nilearn the closest thing ATM is view_img_on_surf: https://nilearn.github.io/stable/auto_examples/01_plotting/plot_3d_map_to_surface_projection.html#d-visualization-in-a-web-browser

1 Like

Thanks, although this still only shows one hemisphere.

Very useful. I want to use this one:

# Install and load required libraries 
# e.g. pip install numpy brainspace surfplot neuromaps nibabel 

from surfplot import Plot
from surfplot.datasets import load_example_data
# Load the surface we want to use as the background
# Read in your own background surface {'.ply', '.vtp', '.vtk', '.fs', '.asc', '.gii'} 
surfaces = read_surface('./path/to/surface/file.gii.gz') 

# Or use one of the surface files included in the neuromaps package 
# Here we are using the 32k FsLR (a symmetric version 
# fsaverage space template with ~32k verticies in each hemisphere
surfaces = fetch_fslr()
lh, rh = surfaces['inflated']

# Next we want to load the effect we want to plot
# on the background surface. The overlay is an array or surface file the same 
# length (number of vertices) as the background surface.  
# We can either read in a surface file in FsLR space
effect = read_surface('./path/to/surface/atlas/file.gii.gz') 

# Or use one of the surface files in FsLR space included with the surfplot package
effect = load_example_data(dataset = 'default_mode', join=True)

# Generate plot
p = Plot(lh, rh, views='lateral', zoom=1.2)
p.add_layer(effect, cbar=True, cmap='inferno')
p.build()

However, how do I use my own nifti file here? Which lines should I insert? It’s not clear, it is only using the library examples.

The line you would want to replace is

You can convert your volumetric to surface data with the connectome workbench wb_command -volume-to-surface-mapping (Connectome - Workbench Commands).

Best,
Steven