[Neuroimaging] Getting scaling and offset from nifti header in nibabel

Matthew Brett matthew.brett at gmail.com
Mon Jan 4 10:05:29 EST 2016


On Mon, Jan 4, 2016 at 2:59 PM, Samuel St-Jean <stjeansam at gmail.com> wrote:
> So I guess I'll experiment with converters that work and see if they give
> the same field as the dicom themselves, thanks. Makes sense after all that
> those field are written by the converter, which might not be reliable. What
> are they supposed to contain/what is their usual purpose? Are those value
> you should apply to the data for whatever reason or that is not defined in
> the nifti standard?

The nifti standard just says that, if you want to add a scale and
intercept to the data, you should use these fields.

If the author of the nifti has set these fields, then they probably
intend for you to use them, and nibabel does use them, for
`np.array(img.dataobj)` and `img.get_data()`.   You can ask nibabel to
give you the data without the scaling, but that is more involved.

Cheers,

Matthew


More information about the Neuroimaging mailing list