Latest release


@matthew-brett matthew-brett released this Aug 23, 2016 · 43 commits to master since this release


New feature release for the 2.1 series.

Most work on NiBabel so far has been by Matthew Brett (MB), Michael Hanke (MH)
Ben Cipollini (BC), Marc-Alexandre Côté (MC), Chris Markiewicz (CM), Stephan
Gerhard (SG) and Eric Larson (EL).

References like "pr/298" refer to github pull request numbers.

New features

  • New API for managing streamlines and their different file formats. This
    adds a new module nibabel.streamlines that will eventually deprecate
    the current trackvis reader found in nibabel.trackvis (pr/391) (MC,
    reviewed by Jean-Christophe Houde, Bago Amirbekian, Eleftherios
    Garyfallidis, Samuel St-Jean, MB);
  • A prototype image viewer using matplotlib (pr/404) (EL, based on a
    proto-prototype by Paul Ivanov) (Reviewed by Gregory R. Lee, MB);
  • Functions for image resampling and smoothing using scipy ndimage (pr/255)
    (MB, reviewed by EL, BC);
  • Add ability to write FreeSurfer morphology data (pr/414) (CM, BC, reviewed
    by BC);
  • Read and write support for DICOM tags in NIfTI Extended Header using
    pydicom (pr/296) (Eric Kastman).


  • Extensions to FreeSurfer module to fix reading and writing of FreeSurfer
    geometry data (pr/460) (Alexandre Gramfort, Jaakko Leppäkangas, reviewed
    by EL, CM, MB);
  • Various improvements to PAR / REC handling by Gregory R. Lee: supporting
    multiple TR values (pr/429); output of volume labels (pr/427); fix for
    some diffusion files (pr/426); option for more sophisticated sorting of
    volumes (pr/409);
  • Original trackvis reader will now allow final streamline to have fewer
    points than the number declared in the header, with strict=False
    argument to read function;
  • Helper function to return voxel sizes from an affine matrix (pr/413);
  • Fixes to DICOM multiframe reading to avoid assumptions on the position of
    the multiframe index (pr/439) (Eric M. Baker);
  • More robust handling of "CSA" private information in DICOM files (pr/393)
    (Brendan Moloney);
  • More explicit error when trying to read image from non-existent file
    (pr/455) (Ariel Rokem);
  • Extension to nib-ls command to show image statistics (pr/437) and other
    header files (pr/348) (Yarik Halchenko).

Bug fixes

  • Fixes to rotation order to generate affine matrices of PAR / REC files (MB,
    Gregory R Lee).


  • Dropped support for Pythons 2.6 and 3.2;
  • Comprehensive refactor and generalization of surface / GIFTI file support
    with improved API and extended tests (pr/352-355, pr/360, pr/365, pr/403)
    (BC, reviewed by CM, MB);
  • Refactor of image classes (pr/328, pr/329) (BC, reviewed by CM);
  • Better Appveyor testing on new Python versions (pr/446) (Ariel Rokem);
  • Fix shebang lines in scripts for correct install into virtualenvs via pip
  • Various fixes for numpy, matplotlib, and PIL / Pillow compatibility (CM,
    Ariel Rokem, MB);
  • Improved test framework for warnings (pr/345) (BC, reviewed by CM, MB);
  • New decorator to specify start and end versions for deprecation warnings
    (MB, reviewed by CM);
  • Write qform affine matrix to NIfTI images output by parrec2nii (pr/478)
    (Jasper J.F. van den Bosch, reviewed by Gregory R. Lee, MB).

API changes and deprecations

  • Minor API breakage in original (rather than new) trackvis reader. We are now
    raising a DataError if there are too few streamlines in the file,
    instead of a HeaderError. We are raising a DataError if the track
    is truncated when strict=True (the default), rather than a TypeError
    when trying to create the points array.
  • Change sform code that parrec2nii script writes to NIfTI images; change
    from 2 ("aligned") to 1 ("scanner");
  • Deprecation of get_header, get_affine method of image objects for
    removal in version 4.0;
  • Removed broken from_filespec method from image objects, and deprecated
    from_filespec method of ECAT image objects for removal in 4.0;
  • Deprecation of class_map instance in imageclasses module in favor of
    new image class attributes, for removal in 4.0;
  • Deprecation of ext_map instance in imageclasses module in favor of
    new image loading API, for removal in 4.0;
  • Deprecation of Header class in favor of SpatialHeader, for removal
    in 4.0;
  • Deprecation of BinOpener class in favor of more generic Opener
    class, for removal in 4.0;
  • Deprecation of GiftiMetadata methods get_metadata and get_rgba;
    GiftiDataArray methods get_metadata, get_labeltable,
    set_labeltable; GiftiImage methods get_meta, set_meta. All
    these deprecated in favor of corresponding properties, for removal in 4.0;
  • Deprecation of giftiio read and write functions in favor of
    nibabel load and save functions, for removal in 4.0;
  • Deprecation of gifti.data_tag function, for removal in 4.0;
  • Deprecation of write-access to GiftiDataArray.num_dim, and new error
    when trying to set invalid values for num_dim. We will remove
    write-access in 4.0;
  • Deprecation of GiftiDataArray.from_array in favor of GiftiDataArray
    constructor, for removal in 4.0;
  • Deprecation of GiftiDataArray to_xml_open, to_xml_close methods in
    favor of to_xml method, for removal in 4.0;
  • Deprecation of parse_gifti_fast.Outputter class in favor of
    GiftiImageParser, for removal in 4.0;
  • Deprecation of parse_gifti_fast.parse_gifti_file function in favor of
    GiftiImageParser.parse method, for removal in 4.0;
  • Deprecation of loadsave functions guessed_image_type and
    which_analyze_type, in favor of new API where each image class tests the
    file for compatibility during load, for removal in 4.0;



@matthew-brett matthew-brett released this Nov 23, 2015 · 746 commits to master since this release


  • Fix for integer overflow on large images (pr/325) (MB);
  • Fix for Freesurfer nifti files with unusual dimensions (pr/332) (Chris
  • Fix typos on benchmarks and tests (pr/336, pr/340, pr/347) (Chris
  • Fix Windows install script (pr/339) (MB);
  • Support for Python 3.5 (pr/363) (MB) and numpy 1.10 (pr/358) (Chris
  • Update pydicom imports to permit version 1.0 (pr/379) (Chris Markiewicz);
  • Workaround for Python 3.5.0 gzip regression (pr/383) (Ben Cipollini).
  • tripwire.TripWire object now raises subclass of AttributeError when trying
    to get an attribute, rather than a direct subclass of Exception. This
    prevents Python 3.5 triggering the tripwire when doing inspection prior to
    running doctests.
  • Minor API change for tripwire.TripWire object; code that checked for
    AttributeError will now also catch TripWireError.



@matthew-brett matthew-brett released this Jun 28, 2015 · 747 commits to master since this release


Contributions from Ben Cipollini, Chris Markiewicz, Alexandre Gramfort,
Clemens Bauer, github user freec84.

  • Bugfix release with minor new features;
  • Added axis parameter to concat_images (pr/298) (Ben Cipollini);
  • Fix for unsigned integer data types in ECAT images (pr/302) (MB, test data
    and issue report from Github user freec84);
  • Added new ECAT and Freesurfer data files to automated testing;
  • Fix for Freesurfer labels error on early numpies (pr/307) (Alexandre
  • Fixes for PAR / REC header parsing (pr/312) (MB, issue reporting and test
    data by Clemens C. C. Bauer);
  • Workaround for reading Freesurfer ico7 surface files (pr/315) (Chris
  • Changed to github pages for doc hosting;
  • Changed docs to point to mailing list.



@matthew-brett matthew-brett released this Dec 9, 2014 · 812 commits to master since this release


This release had large contributions from Eric Larson, Brendan Moloney,
Nolan Nichols, Basile Pinsard, Chris Johnson and Nikolaas N. Oosterhof.

  • New feature, bugfix release with minor API breakage;
  • Minor API breakage: default write of NIfTI / Analyze image data offset
    value. The data offset is the number of bytes from the beginning of file
    to skip before reading the image data. Nibabel behavior changed from
    keeping the value as read from file, to setting the offset to zero on
    read, and setting the offset when writing the header. The value of the
    offset will now be the minimum value necessary to make room for the header
    and any extensions when writing the file. You can override the default
    offset by setting value explicitly to some value other than zero. To read
    the original data offset as read from the header, use the offset
    property of the image dataobj attribute;
  • Minor API breakage: data scaling in NIfTI / Analyze now set to NaN when
    reading images. Data scaling refers to the data intercept and slope
    values in the NIfTI / Analyze header. To read the original data scaling
    you need to look at the slope and inter properties of the image
    dataobj attribute. You can set scaling explicitly by setting the
    slope and intercept values in the header to values other than NaN;
  • New API for managing image caching; images have an in_memory property
    that is true if the image data has been loaded into cache, or is already
    an array in memory; get_data has new keyword argument caching to
    specify whether the cache should be filled by get_data;
  • Images now have properties dataobj, affine, header. We will
    slowly phase out the get_affine and get_header image methods;
  • The image dataobj can be sliced using an efficient algorithm to avoid
    reading unnecessary data from disk. This makes it possible to do very
    efficient reads of single volumes from a time series;
  • NIfTI2 read / write support;
  • Read support for MINC2;
  • Much extended read support for PAR / REC, largely due to work from Eric
    Larson and Gregory R. Lee on new code, advice and code review. Thanks also
    to Jeff Stevenson and Bennett Landman for helpful discussion;
  • parrec2nii script outputs images in LAS voxel orientation, which
    appears to be necessary for compatibility with FSL dtifit /
    fslview diffusion analysis pipeline;
  • Preliminary support for Philips multiframe DICOM images (thanks to Nolan
    Nichols, Ly Nguyen and Brendan Moloney);
  • New function to save Freesurfer annotation files (by Github user ohinds);
  • Method to return MGH format vox2ras_tkr affine (Eric Larson);
  • A new API for reading unscaled data from NIfTI and other images, using
    img.dataobj.get_unscaled(). Deprecate previous way of doing this,
    which was to read data with the read_img_data function;
  • Fix for bug when replacing NaN values with zero when writing floating
    point data as integers. If the input floating point data range did not
    include zero, then NaN would not get written to a value corresponding to
    zero in the output;
  • Improvements and bug fixes to image orientation calculation and DICOM
    wrappers by Brendan Moloney;
  • Bug fixes writing GIfTI files. We were using a base64 encoding that didn't
    match the spec, and the wrong field name for the endian code. Thanks to
    Basile Pinsard and Russ Poldrack for diagnosis and fixes;
  • Bug fix in freesurfer.read_annot with orig_ids=False when annot
    contains vertices with no label (Alexandre Gramfort);
  • More tutorials in the documentation, including introductory tutorial on
    DICOM, and on coordinate systems;
  • Lots of code refactoring, including moving to common code-base for Python
    2 and Python 3;
  • New mechanism to add images for tests via git submodules.



@matthew-brett matthew-brett released this Sep 11, 2012 · 1562 commits to master since this release


Special thanks to Chris Johnson, Brendan Moloney and JB Poline.

  • New feature and bugfix release
  • Add ability to write Freesurfer triangle files (Chris Johnson)
  • Relax threshold for detecting rank deficient affines in orientation
    detection (JB Poline)
  • Fix for DICOM slice normal numerical error (issue #137) (Brendan Moloney)
  • Fix for Python 3 error when writing zero bytes for offset padding



@matthew-brett matthew-brett released this Jun 27, 2012 · 1591 commits to master since this release


  • Bugfix release
  • Fix longdouble tests for Debian PPC (thanks to Yaroslav Halchecko for
    finding and diagnosing these errors)
  • Generalize longdouble tests in the hope of making them more robust
  • Disable saving of float128 nifti type unless platform has real IEEE
    binary128 longdouble type.



@matthew-brett matthew-brett released this Jun 14, 2012 · 1601 commits to master since this release


Particular thanks to Yaroslav Halchecko for fixes and cleanups in this

  • Bugfix release
  • Make compatible with pydicom 0.9.7
  • Refactor, rename nifti diagnostic script to nib-nifti-dx
  • Fix a bug causing an error when analyzing affines for orientation, when the
    affine contained all 0 columns
  • Add missing dicomfs script to installation list and rename to