Name: niwidgets
Owner: neurohackweek
Description: Widgets to use inside jupyter notebooks to display imaging data
Forked from: lukassnoek/niwidgets
Created: 2017-09-07 22:56:17.0
Updated: 2017-09-09 08:01:20.0
Pushed: 2017-09-08 20:42:53.0
Homepage: http://www.janfreyberg.com/niwidgets/
Size: 11895
Language: Jupyter Notebook
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
niwidgets
)By Jan Freyberg and Bjoern Soergel
This repository is supposed to provide easy and general wrappers to display interactive widgets that visualise standard-format neuroimaging data, using new functions and standard functions from other libraries. It looks like this:
Install via:
install niwidgets
Or, to get the most up-to-date version from github:
install git+git://github.com/janfreyberg/niwidgets/
It requires nibabel and nilearn:
install nibabel nilearn
Check out the examples using the code in this notebook here: https://github.com/janfreyberg/niwidgets/blob/master/visualisation_wrapper.ipynb (you need to run the notebook on your local machine to use the interactive features).
So far, the widgets support plotting of nifti files, either in nii
or nii.gz
format. You initialise a widget class like this:
niwidgets import NiftiWidget
idget = NiftiWidget('./path/to/file.nii')
You can then create a plot either with our default nifti plotter:
idget.nifti_plotter()
This will give you sliders to slice through the image, and an option to set the colormap.
You can also provide your own plotting function:
rt nilearn.plotting as nip
idget.nifti_plotter(plotting_func=nip.plot_glass_brain)
By default, this will give you the following interactive features:
nip.plot_img
)You can, however, always provide features you would like to have interactive yourself. This follows the normal ipywidgets format. For example, if you provide a list of strings for a keyword argument, this becomes a drop-down menu. If you provide a tuple of two numbers, this becomes a slider. Take a look at some examples we have in this notebook (you need to run the notebook on your local machine to use the interactive features).
Hopefully we will be able to add more default interactive features in the future, as well as plotting of other data (such as surface projections). If you have any suggestions for plot features to be added, please let us know - or add them yourself and create a pull request!
As always with pip packages, you can install a “development” version of this package by cloning the git repository and installing it via pip install -e /path/to/package
.