Skip to main content

# Neuroimaging Widgets (niwidgets)

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:

![](https://thumbs.gfycat.com/ExcitableReflectingLcont-size_restricted.gif)

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 NiftiWidget my_widget = NiftiWidget('./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.

—

_Developed by [Jan Freyberg](http://www.twitter.com/janfreyberg), [Bjoern Soergel](http://www.ast.cam.ac.uk/~bs538/), [Satrajit Ghosh](https://github.com/satra), [Melanie Ganz](https://github.com/melanieganz), [Murat Bilgel](https://github.com/bilgelm), [Ariel Rokem](https://github.com/arokem), and [elyb01](https://github.com/elyb01)._

Metadata

Release files for niwidgets 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for niwidgets 0.1.4
File Size Uploaded Provenance Actions
niwidgets-0.1.4.tar.gz 4.7 MB Without provenance Details for niwidgets-0.1.4.tar.gz

Release files / niwidgets-0.1.4.tar.gz

Download URL niwidgets-0.1.4.tar.gz
Size 4.7 MB
Tags Source
SHA-256 checksum
How to use checksums
a302adec8fd80a14ff22d9ce9588077c9803caa00f54e0b05fb9ad3d843998a1
BLAKE2b-256 checksum
How to use checksums
f35529ce4c41fa88f7844587f050d5496b1bad6ff730a6ef52e8dd7dbc9fcdb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for niwidgets 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page