RF: add write0 to seek_tell function and test

Add flag to allow seek_tell to write zeros to reach a given file offset,
if it can't get there with a seek.
BF: test and fix writing of bz2 files with offsets

Writing a bz2 file that wasn't already at the data offset position
caused IOError because of failed write seek on bz2 files.

Use extended seek_tell function to write zeros to reach offset, when
seek fails.
RF: remove redundant _write_header method

We only used image _write_header method for seeking to the data position
in a nifti single image.  Now I've moved that logic to seek_tell, and
therefore 'Analyze.to_file_map', we don't need _write_header.  Remove.
There aren't any good tests for parrec2nii - so I have to hope changes
worked right.
TST: skip test big offset tests without scipy

Offset tests need writing, which need scipy; skip if missing.
Merge pull request #219 from matthew-brett/remove-_write_header

MRG: remove _write_header method

The write_header method in the image classes was only being used to write zero
bytes into a file where the data was not exactly at the end of the header. Use
the seek_tell function for this, and remove the writeheader method from all
classes.
RF: refactor proxy slice testing for generality

I want to use the slice generation for the array proxy tests.
NF+TST: add arbitrary slicing of default array proxy

Plumb in fileslice to do arbitrary slicing of array proxy objects, for
the default array proxy object.

Tests for default ArrayProxy object cover Nifti1+2, Analyze, SPM99+2,
MGH proxy objects.
NF: function to predict output axes after slicing

ECAT proxy slicing needs to know which axis in the output array it is
slicing over, when reading volumes.  Make a function to predict output
axes corresponding to input axes after slicing.
RF: adapt slice generation to lengths of 1

Some images have axis length 1, adapt to this when creating example
slices for given length.
RF: add proxy slicing to ECAT array proxy

Difficult to test well because the example image only contains one
volume.
RF: refactor MINC tests to allow more examples

I'm going to add more example files to test.
TST+BF: add test for single scalefactor in MINC

Fix bug for getting the scalars from NetCDF and HDF5 variables.

Add single-scale datasets for MINC1 and MINC2.
TST: add MINC 4D tests (so 2D scaling tests)

Add MINC 1 and 2 4D files.  This tests 4D load, but also image min / max
scaling for more than one dimension.
NF+TST: add slicing to Minc?File, MINC array proxy

Make Minc1File, Minc2File sliceable using `get_scaled_data`.

Use this to implement array proxy slicing.
TST: add generic array proxy slicing tests

Add smaller array proxy slicing tests to array proxy API checks  The
fuller checks need to go with the individual proxy class tests, because
they are too time-consuming to check for each possible array proxy
instance.
RF: enforce mode='r' for opening HDF5 files

For some reason, the tests were running fine with the default assumption
that h5py.File was ``mode='r'`` by default, when run on their own
(``nosetests nibabel/tests/test_proxy_api.py``) but not when run as part
of the full test suite (``nosetests nibabel``).  Maybe there's a global
flag in the HDF library somewhere that was getting flipped.
NF: add is_proxy utility function

Function to test whether we have a proxy object
NF: ArrayProxy can use C or F array memory layout

Implement and test ability to use C memory layout arrays on disk as well
as Fortran order (we could only do Fortran before).
DOC: update proxy API definition in docstrings

Clean up and update docstrings for ArrayProxy class.
Merge pull request #211 from matthew-brett/add-proxy-slicing

MRG: add proxy slicing

Long awaited API to be able to do arbitrary slicing on array proxies from images.

Meaning, you can slice data from images without loading the whole image from disk.

Of course this can save memory, but it can also be much faster. For an
uncompressed nifti image:

In [17]: timeit img = nib.load(fname1); arr = img.dataobj[..., 120]
1000 loops, best of 3: 1.7 ms per loop

In [19]: timeit img = nib.load(fname1); arr = img.get_data()[..., 120]
1 loops, best of 3: 713 ms per loop
For a gzipped image, the savings depend on the position in the file:

In [8]: timeit img = nib.load(fname); arr = img.dataobj[..., 2]
10 loops, best of 3: 30.7 ms per loop

In [7]: timeit img = nib.load(fname); arr = img.get_data()[..., 2]
1 loops, best of 3: 1.32 s per loop

In [12]: timeit img = nib.load(fname); arr = img.dataobj[..., 40]
1 loops, best of 3: 466 ms per loop

In [11]: timeit img = nib.load(fname); arr = img.get_data()[..., 40]
1 loops, best of 3: 1.31 s per loop

In [13]: timeit img = nib.load(fname); arr = img.dataobj[..., 100]
1 loops, best of 3: 1.15 s per loop

In [14]: timeit img = nib.load(fname); arr = img.dataobj[..., 120]
1 loops, best of 3: 1.38 s per loop