Giter Club home page Giter Club logo

niwidgets's Introduction

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:

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 (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, Bjoern Soergel, Satrajit Ghosh, Melanie Ganz, Murat Bilgel, Ariel Rokem, and elyb01.

niwidgets's People

Contributors

bilgelm avatar cancan101 avatar janfreyberg avatar melanieganz avatar satra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.