[Neuroimaging] Nibabel API change - always read as float
Matthew Brett
matthew.brett at gmail.com
Mon Jul 6 23:29:09 CEST 2015
Hi,
On Mon, Jul 6, 2015 at 10:17 PM, Ben Cipollini <bcipolli at ucsd.edu> wrote:
> I think it's clear that to an end-user, what data you get out of an image
> file may be unclear. Sounds like there's support for enabling a dtype
> argument, which allows explicit casting (and pointed documentation to tell
> users that you may not know what data type that comes out of load with
> dtype=None).
>
> The discussion seems to be about what the best default behavior would be.
Yes, that is the main issue.
> Right now, seems to me that dtype=None would be the best default. Here's
> why:
>
> If users are very unaware of numpy, they're unlikely to be doing the types
> of numeric operations on raw data that @matthewbrett hit--which is the only
> real error we've come across.
I don't think we think things like sum or plus are advanced numpy
operations. There's a reason this was in the first or second class in
our course.
> If users are aware of numpy, then they should be familiar with the need to
> type-cast loaded data.
I think - as Brendan implied - they would expect the data to be in a
reasonable form unless there was a good reason for it not to be. At
the moment, there really isn't a good reason for it not to be float,
by default - whether it's int or float is usually an accident of the
way the file was written.
> Plus, the documentation will tell them that when
> documenting the dtype arg. Now, they'll have an easy way to be safe--pass an
> explicit type.
But that is the kind of thing I'd expect an advanced user to pick up.
> I still don't see a strong case for confusions and errors.
I can only repeat - I made this error myself - in a very early and
introductory class.
Cheers,
Matthew
More information about the Neuroimaging
mailing list