[Neuroimaging] Nibabel API change - always read as float

Brendan Moloney moloney at ohsu.edu
Tue Jul 7 03:13:36 CEST 2015



> The question is the following: you've written code that deal with a label
> image. Some one gives you an image as an input. It's a float dtype. How
> do you know whether the user loaded the wrong image, or it's just right
> and the loading library did the conversion? The loss of semantics implied
> by the casting makes it harder to have a good behavior / error message.

What is so bad about raising an exception saying masks/labels must have an 
integer dtype? You could even include a helpful hint about explicitly requesting
the correct dtype from nibabel's 'get_data' method or from numpy's array 
creation functions.


More information about the Neuroimaging mailing list