nipy/nibabel — pull request #227 by matthew-brett (2014-02-16 00:06:52+00:00)
Title: WIP: fix and refactor par / rec read / write

par / rec read write wasn't tested and I'd broken it some time ago by
some refactoring of file IO and of the ArrayProxy class.

I fixed my breakages and also:

* Added PAR / REC data to test against - thanks Michael
* added some methods to PARRECHeader to make it work with the new
ArrayProxy class
* Changed TR scaling from milliseconds to seconds; I think that's right.
* Added tests of the script and the module

I've tested against the nifti file that Philips generated from the same
data -- from : http://psydata.ovgu.de/philips_achieva_testfiles/

A remaining issue is that our affine differs from the affine Philips
writes into its own conversion to Nifti::

In [26]: np.allclose(our_conv.get_sform(), our_conv.get_qform())
Out[26]: True

In [27]: np.allclose(philips_conv.get_sform(), np.eye(4))
Out[27]: True

In [28]: our_conv.get_qform()
Out[28]:
array([[ -3.6499, -0. , 1.8356, 123.6628],
[ -0. , -3.75 , -0. , 115.617 ],
[ 0.8605, -0. , 7.7866, -58.2506],
[ 0. , 0. , 0. , 1. ]])

In [29]: philips_conv.get_qform()
Out[29]:
array([[ -3.65 , -0.0016, 1.8356, 125.4881],
[ 0.0016, -3.75 , -0.0004, 117.4916],
[ 0.8604, 0.0002, 7.7866, -28.3411],
[ 0. , 0. , 0. , 1. ]])