[Neuroimaging] Nibabel API change - always read as float

Gael Varoquaux gael.varoquaux at normalesup.org
Tue Jul 7 00:12:53 CEST 2015


On Mon, Jul 06, 2015 at 05:13:00PM +0100, Matthew Brett wrote:
> I did precisely run into this when teaching the students.  I was
> teaching them to run diagnostics, and the script I wrote used the sum.
> This worked fine on one set of functional images, but gave a
> completely wrong answer on another set of images, and it took me a
> little while to work out what had gone wrong.  Part of the problem is
> that nifti images are often int16, so it's easy to run into silent
> horrors just by adding or subtracting. 

But that's standard: operating on data requires to be aware of this.
Converting to float just moves the goal post.

> My feeling is that dealing with any operations on int16 arrays is for
> advanced users. 

My feeling is that doing such numerical operations on data is for
advanced users. Basic users should just be using libraries that operate
on images, and not implement the operations themselves. By converting
everything to float, you are making the job of these libraries harder. If
these libraries are doing numerical operations that might overflow (any
kind of numerical calculs, actually), they need to convert to float. If
they are using the data to do masking, or for ROIs defined by integer
values, they should.

I have the impression that we are regressing to matlab world, where
everything can only be floats, or you will get weird bugs/


More information about the Neuroimaging mailing list