[Neuroimaging] Nibabel API change - always read as float
Alexandre ABRAHAM
abraham.alexandre at gmail.com
Tue Jul 7 00:22:47 CEST 2015
> > Yes. So they could have casted all data to float if they wanted to, but
> they didn't.
>
> This is not analogous at all.
>
You just compared loading of Nifti files, which are binary, to loading of
text files. So I consider my comparison of npy binary files to Nifti files
as analagous.
> So every time you load a mask you check if the values are strictly zeros
> and ones?
>
Yes, this is basic error handling for non-technical users.
I don't. I find it useful to allow a label image to be used as a mask. What
> if
> someone passes in the image and it is just zeros and ones? Do you raise
> an
> exception because you are guessing they accidentally passed in a mask
> instead
> of the image?
>
In our lib, mask images must have 2 values, one of them being 0. The MRI
images live in a wider space, but they can be binary. Actually, a value may
be raised because we work with function MRI that must be 4D in most cases.
> If you passed an integer dtype to 'nibabel.load' and the file has scaling
> factors, we
> could raise an exception. So your use case might actually be an argument
> for this
> proposal rather than against it.
>
I don't see your point here.
> 1) You know the image is providing a mask or labels from context
>
As said before, implicit cast won't work in that case.
> 2) You want to save memory and know what you are doing
>
Agreed.
> Without this proposal you need to cast everything to float except for the
> above
> cases, which seems worse to me (ignoring the argument for novices).
>
No, I don't have to cast everything to float. I only cast MRI images to
float when it is needed.
Honestly, I don't see the point in convincing people that your choice is
the good one. In my usecases, it is clearly not. Whatever choice is made, I
will just deal with it.
Alex.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20150707/a8641307/attachment.html>
More information about the Neuroimaging
mailing list