niwidgets.SurfaceWidget

class niwidgets.SurfaceWidget(meshfile, overlayfiles=())[source]

Interact with brain surfaces right in the notebook.


Methods

Surface widget methods:

surface_plotter([colormap, figsize, …]) Visualise a surface mesh (with overlay) inside notebooks.
zmask(surf, mask) Masks out vertices with intensity=0 from overlay.

Methods Details

class niwidgets.SurfaceWidget(meshfile, overlayfiles=())[source]

Interact with brain surfaces right in the notebook.

surface_plotter(colormap=None, figsize=array([600, 600]), figlims=array([[-100, 100], [-100, 100], [-100, 100]]), show_zeroes=True, **kwargs)[source]

Visualise a surface mesh (with overlay) inside notebooks.

This method displays the surface widget.

Parameters:
  • surface (str, gifti object) – Path to surface file in gifti or FS surface format or an already loaded gifti object of surface
  • overlay (str, gifti object) – Path to overlay file in gifti or FS annot or anatomical (.curv,.sulc,.thickness) format or an already loaded gifti object of overlay, default None
  • colormap (string) – A matplotlib colormap, default summer
  • figsize (ndarray) – Size of the figure to display, default [600,600]
  • figlims (ndarray) – x,y and z limits of the axes, default [[-100,100],[-100,100],[-100,100]]
  • show_zeroes (bool) – Display vertices with intensity = 0, default True
zmask(surf, mask)[source]

Masks out vertices with intensity=0 from overlay.

Also returns masked-out vertices.

Parameters:
  • surf (gifti object) – already loaded gifti object of target surface
  • mask (gifti object) – already loaded gifti object of overlay with zeroes at vertices of no interest (e.g. medial wall)
Returns:

  • mask_keep (np.ndarray) – Boolean array of what to show.
  • mask_kill (np.ndarray) – Boolean array of what to hide.