Skip to main content

A package that provides ipywidgets for standard neuroimaging plotting

Project description

# Neuroimaging Widgets (niwidgets) _By [Jan Freyberg](http://www.twitter.com/janfreyberg) and [Bjoern Soergel](http://www.ast.cam.ac.uk/~bs538/)_

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.

Install via: ` pip install niwidgets ` Or, to get the most up-to-date version from github: ` pip install git+git://github.com/janfreyberg/niwidgets/ `

It requires nibabel and nilearn: ` pip 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).

### Usage:

So far, the widgets support plotting of nifti files, either in nii or nii.gz format. You initialise a widget class like this:

` from niwidgets import NiWidget my_widget = NiWidget('./path/to/file.nii') `

You can then create a plot either with our default nifti plotter:

` my_widget.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: ` import nilearn.plotting as nip my_widget.nifti_plotter(plotting_func=nip.plot_glass_brain) `

By default, this will give you the following interactive features: - selecting a colormap - if supported by the plotting function, x-y-x sliders (e.g. for 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](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).

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!

### Development installation

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

niwidgets-0.1.3.tar.gz (4.7 MB view details)

Uploaded Source

File details

Details for the file niwidgets-0.1.3.tar.gz.

File metadata

  • Download URL: niwidgets-0.1.3.tar.gz
  • Upload date:
  • Size: 4.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for niwidgets-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6a36bc86f419f0990ec6af124fbaf9dd0f2a9aa44952dd542498c01e4bd6502a
MD5 2e90710aee5a3efc63175b1dc8bf3d23
BLAKE2b-256 08d624a0b41621c712c8c2346a73a00cd7a6d682fd96262acd849323b08689e2

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page