[Neuroimaging] Nibabel API change - always read as float
Alexandre ABRAHAM
abraham.alexandre at gmail.com
Mon Jul 6 23:25:22 CEST 2015
> I don't find this behavior to be particularly logical. I guess
> there is a reason the default is 'float'.
>
For example, if the first column is an index, casting it to float makes no
sense.
> Because it is a nice clean file format they control entirely.
>
Yes. So they could have casted all data to float if they wanted to, but
they didn't.
> I clearly acknowledged that in the next paragraph (which you trimmed),
> and you don't address the fact that is almost always obvious from
> context if the file is a mask/label. It isn't always obvious if an image
> file is going to be float or not.
>
Well the context is also obvious when you load MRI data, just cast it to
float in all cases. And no, it's not simple to pass a dtype when loading a
mask. If an image is contains float values between 0 and 2, casting it to
int will round the values to 0 and 1, ie a valid mask. But clearly, the
file loaded was not meant to be used as a mask in the first place.
Alex.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20150706/e9935d1a/attachment.html>
More information about the Neuroimaging
mailing list