[Neuroimaging] reg. load nifti image
Matthew Brett
matthew.brett at gmail.com
Thu Jan 21 13:10:05 EST 2016
Hi,
On Thu, Jan 21, 2016 at 1:11 AM, Raghav Mehta
<raghav.mehta at research.iiit.ac.in> wrote:
> Hi,
>
> Pre-defined thresold is -6.6e-14, while value of w2 for my data is -6.401211e-07. So when I change the thresold is works perfectly?? Can you please explain how this may effect processing of data. as I had to multiply quaternion thresold with 1e9 to get proper thresold value
>
Oh - whoops - I missed off a negative sign, maybe that explains the confusion.
The default threshold is:
In [11]: -np.finfo(np.float32).eps * 3
Out[11]: -3.5762786865234375e-07
Your value appears to be a little below that, at -6.401211e-07. So,
with a threshold of:
In [13]: -np.finfo(np.float32).eps * 10
Out[13]: -1.1920928955078125e-06
you should be fairly safe, with a reasonable threshold.
>>> import numpy as np
>>> import nibabel as nib
>>> nib.Nifti1Header.quaternion_threshold = -np.finfo(np.float32).eps * 10 # notice new minus sign
>>> img = nib.load('bad_image.nii')
Does that work?
Matthew
More information about the Neuroimaging
mailing list