NiBabel

From Brede Wiki
Jump to: navigation, search
Software (help)
NiBabel
Description: Read and write neuroimaging files
Developer: NiBabel developes
Language: Python
License: MIT License
Link: http://nipy.org/nibabel/
Database(s): Open Hub
Feature(s): NIfTI reading

NiBabel is a Python package to handle different types of neuroimaging file formats. It is available from:

http://nipy.org/nibabel/

It is developed by Matthew Brett and Michael Hanke with contributions from a number of other people, e.g., Stephan Gerhard,Yaroslav O. Halchenko, Christian Haselgrove, Gaël Varoquaux and Bertrand Thirion.

[edit] Installation

It is directly installable on Ubuntu:

$ sudo aptitude install python-nibabel

There is an associated data set with standard human brain atlas templates. As displayed on the NiBabel homepage [1] this is installable with:

$ curl -O http://nipy.sourceforge.net/data-packages/nipy-templates-0.1.tar.gz
$ tar zxvf nipy-templates-0.1.tar.gz
$ cd nipy-templates-0.1
$ sudo python setup.py install

[edit] Example

Load the Colin27 human brain atlas with the nifti1 module from the data file provided and make a 2D plot with matplotlib:

from nibabel import nifti1
import matplotlib.pyplot as plt
 
filename = '/usr/local/share/nipy/nipy/templates/colin27/2mm/T1.nii.gz'
colin27 = nifti1.load(filename)
volume = colin27.get_data()
plt.imshow(volume[:,:,50])
plt.show()

[edit] Related software

  1. PySurfer
Personal tools