[Neuroimaging] reg. load nifti image

Raghav Mehta raghav.mehta at research.iiit.ac.in
Wed Jan 20 22:36:39 EST 2016


Hi,

I am trying to read Nifti images using Nibabel, but when I am using nib.load to load the file from perticlar dataset I am getting following error: 

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/nibabel/loadsave.py", line 44, in load
    return guessed_image_type(filename).from_filename(filename, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nibabel/keywordonly.py", line 16, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nibabel/analyze.py", line 986, in from_filename
    return klass.from_file_map(file_map, mmap=mmap)
  File "/usr/local/lib/python2.7/dist-packages/nibabel/keywordonly.py", line 16, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nibabel/analyze.py", line 956, in from_file_map
    img._affine = header.get_best_affine()
  File "/usr/local/lib/python2.7/dist-packages/nibabel/nifti1.py", line 642, in get_best_affine
    return self.get_qform()
  File "/usr/local/lib/python2.7/dist-packages/nibabel/nifti1.py", line 822, in get_qform
    quat = self.get_qform_quaternion()
  File "/usr/local/lib/python2.7/dist-packages/nibabel/nifti1.py", line 797, in get_qform_quaternion
    return fillpositive(bcd, self.quaternion_threshold)
  File "/usr/local/lib/python2.7/dist-packages/nibabel/quaternions.py", line 99, in fillpositive
    raise ValueError('w2 should be positive, but is %e' % w2)
ValueError: w2 should be positive, but is -6.401211e-07


I know this due to fill option in quaternions.py file. My question is how can I disable that option and read these files.

This issue is only for this perticular dataset. I am able to read other files normally from other dataset. Can anyone help me in solving this issue??

Regards,
Raghav Mehta


More information about the Neuroimaging mailing list