niwidgets.StreamlineWidget

class niwidgets.StreamlineWidget(filename=None, streamlines=None)[source]

Turns nibabel track files into interactive plots using ipyvolume.

Color for each line is rendered as a function of the endpoints of the streamline. Currently, this resolves to red for left-right, green for anterior-posterior, and blue for inferior-superior.

Parameters:
  • filename (str, pathlib.Path) – The path to your .trk file. Can be a string, or a PosixPath from python3’s pathlib.
  • streamlines (a nibabel streamline object) – An streamlines attribute of an object loaded by nibabel.streamlines.load

Methods

Streamline widget methods:

plot([display_fraction]) This is the main method for this widget.

Methods Details

class niwidgets.StreamlineWidget(filename=None, streamlines=None)[source]

Turns nibabel track files into interactive plots using ipyvolume.

Color for each line is rendered as a function of the endpoints of the streamline. Currently, this resolves to red for left-right, green for anterior-posterior, and blue for inferior-superior.

Parameters:
  • filename (str, pathlib.Path) – The path to your .trk file. Can be a string, or a PosixPath from python3’s pathlib.
  • streamlines (a nibabel streamline object) – An streamlines attribute of an object loaded by nibabel.streamlines.load
plot(display_fraction=0.1, **kwargs)[source]

This is the main method for this widget.

Parameters:
  • display_fraction (float) – The fraction of streamlines to show
  • percentile (int) – The initial number of streamlines to show using a percentile of length distribution
  • width (int) – The width of the figure
  • height (int) – The height of the figure