Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

nilearn.surface.SurfaceImage

class nilearn.surface.SurfaceImage(mesh, data)[source]

Surface image containing meshes & data for both hemispheres.

Added in version 0.11.0.

Parameters:
meshnilearn.surface.PolyMesh, or dict of nilearn.surface.SurfaceMesh, str, pathlib.Path

Meshes for the both hemispheres.

datanilearn.surface.PolyData, or dict of numpy.ndarray, str, pathlib.Path

Data for the both hemispheres.

squeeze_on_savebool or None, default=None

If True axes of length one from the data will be removed before saving them to file. If None is passed, then the value will be set to True if any of the data parts is one dimensional.

Attributes:
shape(int, int)

Shape of the data.

__init__(mesh, data)[source]

Create a SurfaceImage instance.

property shape

Shape of the data.

classmethod from_volume(mesh, volume_img, inner_mesh=None, **vol_to_surf_kwargs)[source]

Create surface image from volume image.

Parameters:
meshnilearn.surface.PolyMesh or dict of nilearn.surface.SurfaceMesh, str, pathlib.Path

Surface mesh.

volume_imgNiimg-like object

3D or 4D volume image to project to the surface mesh.

inner_meshnilearn.surface.PolyMesh or dict of nilearn.surface.SurfaceMesh, str, pathlib.Path, default=None

Inner mesh to pass to nilearn.surface.vol_to_surf.

vol_to_surf_kwargsdict[str, Any]

Dictionary of extra key-words arguments to pass to nilearn.surface.vol_to_surf.

Examples

>>> from nilearn.surface import SurfaceImage
>>> from nilearn.datasets import load_fsaverage
>>> from nilearn.datasets import load_sample_motor_activation_image
>>> fsavg = load_fsaverage()
>>> vol_img = load_sample_motor_activation_image()
>>> img = SurfaceImage.from_volume(fsavg["white_matter"], vol_img)
>>> img
<SurfaceImage (20484,)>
>>> img = SurfaceImage.from_volume(
...     fsavg["white_matter"], vol_img, inner_mesh=fsavg["pial"]
... )
>>> img
<SurfaceImage (20484,)>

Examples using nilearn.surface.SurfaceImage

Working with Surface images

Working with Surface images

Loading and plotting of a cortical surface atlas

Loading and plotting of a cortical surface atlas

Seed-based connectivity on the surface

Seed-based connectivity on the surface

Making a surface plot of a 3D statistical map

Making a surface plot of a 3D statistical map

Cortical surface-based searchlight decoding

Cortical surface-based searchlight decoding

Example of surface-based first-level analysis

Example of surface-based first-level analysis

Surface-based dataset first and second level analysis of a dataset

Surface-based dataset first and second level analysis of a dataset

A short demo of the surface images & maskers

A short demo of the surface images & maskers