[Neuroimaging] Nibabel API change - always read as float

Brendan Moloney moloney at ohsu.edu
Wed Jul 8 10:22:04 CEST 2015


I meant that the Nifti standard doesn't give much guidance on the interaction 
between scl_slope and the storage datatype.
________________________________________
From: Neuroimaging [neuroimaging-bounces+moloney=ohsu.edu at python.org] on behalf of Satrajit Ghosh [satra at mit.edu]
Sent: Tuesday, July 07, 2015 7:35 PM
To: Neuroimaging analysis in Python
Subject: Re: [Neuroimaging] Nibabel API change - always read as float

hi brendan,

here is the line:

Floating point types are presumed to be stored in IEEE-754 format.

this is about how data are stored on disk. nifti-1 does not say anything about what a user does with data. i only intended to say that data stored back should conform to ieee-754 when stored as dt_float.

cheers,

satra

On Tue, Jul 7, 2015 at 2:16 PM, Brendan Moloney <moloney at ohsu.edu<mailto:moloney at ohsu.edu>> wrote:
> the nifti-1 standard (http://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h)
> has a datatype field. there are two scenarios with scaling:
>
> 1. scl_slope == 0:
>
> 2. scl_slope != 0:
>    data should be converted to IEEE-754  floats as per the nifti standard.
> given nifti was around 2001 this probably did not reflect the updated
> IEE754-2008 standard, but > relied on the 1985 standard. i don't think the
> nifti-1 standard makes it clear what this float should correspond to, i.e.,
> 16/32/64/128 bit floats.

I don't see that in the standard.  All I see is:


   If the scl_slope field is nonzero, then each voxel value in the dataset
   should be scaled as
      y = scl_slope * x + scl_inter
   where x = voxel value stored
         y = "true" voxel value
   Normally, we would expect this scaling to be used to store "true" floating
   values in a smaller integer datatype, but that is not required.  That is,
   it is legal to use scaling even if the datatype is a float type (crazy,
   perhaps, but legal).


_______________________________________________
Neuroimaging mailing list
Neuroimaging at python.org<mailto:Neuroimaging at python.org>
https://mail.python.org/mailman/listinfo/neuroimaging




More information about the Neuroimaging mailing list