[Neuroimaging] Nibabel API change - always read as float

Satrajit Ghosh satra at mit.edu
Wed Jul 8 04:36:39 CEST 2015


hi matthew,

quick follow up question on proposed change. would saving the image back to
disk restore the original datatype? i.e. i read a uint8 image and save it
to another location, would that new file by 8 times the size of the
original file?

cheers,

satra

On Tue, Jul 7, 2015 at 10:29 PM, Satrajit Ghosh <satra at mit.edu> wrote:

> hi matthew,
>
>
>> We have to address ourselves to the standard as it is actually used.
>> As the standard is used, there is almost never a reason to assume that
>> an image with slope = 1, intercept = 0 is really intended to be used
>> as integers in memory.
>>
>
> to me this would always be float in memory. since slope == 1 and != 0.
>
>
>> To emphasize, there is currently no guarantee that an image will be
>> identical if round tripped, and in general, it will not be identical
>> now, if slope != 1 and intercept != 0.
>>
>
> what if scl_slope == 0, shouldn't we expect roundtrip identity?
>
> I realize that the default change will use more memory, but I don't
>> think we should be increasing the risk of silent generation of
>> entirely wrong results in order to optimize memory, in the default
>> case.
>
>
> i agree, but is there a way to allow for keeping the datatype intact? are
> we agreeing that a keyword is necessary, and dtype=None will keep the
> original datatype.
>
>
>> To improve the quality of the discussion - has anyone got an example
>> of a real script that will give the wrong answer with the proposed
>> change?
>>
>
> at least the common scripts we use won't give a wrong answer. but many of
> our workflows will now crash because they would require additional memory
> for specific pieces. now that's several layers embedded from a user point
> of view.
>
> is the proposed change the augmented proposal to include a dtype keyword?
>
> cheers,
>
> satra
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20150707/e7cfd28c/attachment.html>


More information about the Neuroimaging mailing list