surfa.vis.Freeview#

class surfa.vis.Freeview(title=None, debug=False)#

A visualization class that wraps the freeview command.

This function assumes FreeView is installed and the freeview command is accessible in the shell. Images can be configured in the wrapper like so:

fv = Freeview() fv.add_image(img) fv.add_image(seg, colormap=’lut’, opacity=0.5) fv.add_mesh(mesh, overlay=overlay) fv.show()

For a quicker but more limited way to wrap freeview, see the fv() function.

Methods

add_flag(flag)#

Add a flag to the freeview command.

Parameters

flag (str) – Extra command-line option added to the freeview call.

add_image(img, **kwargs)#

Adds an image to the freeview window. Any key/value tags allowed as a -v option in the freeview command line can be provided as an additional argument.

Parameters
  • img (array_like, FramedImage, or str) – Image or filename to load in the freeview session.

  • **kwargs – Additional options to append as key/values tags to the freeview volume argument.

add_mesh(mesh, overlay=None, annot=None, **kwargs)#

Adds an image to the freeview window. Any key/value tags allowed as a -v option in the freeview command line can be provided as an additional argument.

Parameters
  • img (array_like, FramedImage, or str) – Image or filename to load in the freeview session.

  • overlay (Overlay or sequence of Overlays) – Load overlay on mesh data.

  • annot (Overlay or sequence of Overlays) – Load annotation on mesh data.

  • **kwargs – Additional options to append as key/values tags to the freeview volume argument.

show(background=True, threads=None)#

Opens the configured FreeView window.

Parameters
  • background (bool) – Run FreeView window as a background process.

  • threads (int) – Number of OMP threads available to FreeView.