nipy/nibabel — pull request #56 by ksubramz (2011-10-14 23:05:43+00:00)
Title: MGH/MGZ volume format support.

My pull request consists of a thorough MGH/MGZ volume reader/writer written in the vein of the nibabel nifti1 reader/writer. Comments about individual files:

* nibabel/freesurfer/mghformat.py : This contains the crux of the code. Since it uses existing helper classes like SpatialImage etc. the standard api for loading and saving MGH images should work ( just like nifti1 images )

The standard interface is something like

from nibabel.freesurfer import mghformat
v = mghformat.load('orig.mgz')

* nibabel/freesurfer/tests/test_mgh_io.py : A rudimentary test program which tests the standard loading and saving of the volumes/ data / affine matrix etc. Of course, this needs to be expanded by quite a bit.

* nibabel/volumeutils.py : This helper file had to be changed to accommodate '.mgz' extensions which are a compressed (gzip ) format. The existing file wouldn't allow that.

* nibabel/tests/data/test.mgz: A small 4D mgz image which is used by the test program.

TODO
---------
* More test cases.
* Documentation showing all of API. ( Though if you have an idea about nibabel it's very easy to get to speed )