[Neuroimaging] Nibabel API change - always read as float

Gael Varoquaux gael.varoquaux at normalesup.org
Tue Jul 7 01:37:05 CEST 2015


On Mon, Jul 06, 2015 at 04:28:02PM -0700, Michael Waskom wrote:
> Also, I feel like if I were writing Python code to operate on a label image, or
> when I really wanted integer typed data for efficiency reasons, I would write
> `data = img.get_data(dtype=int16)` even if the default were None, because it
> would make my intentions/expectations clear.

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.

Gaël


More information about the Neuroimaging mailing list