-
Notifications
You must be signed in to change notification settings - Fork 265
Description
img = nibabel.load('somefile')
dat = img.get_data().copy()
affine = dat.get_affine()
newimg = nibabel.Nifti1Image(dat, affine)
rasies an error
/usr/local/python2.6.2/lib/python2.6/site-packages/nibabel/analyze.pyc in set_data_dtype(self, datatype)
836 except KeyError:
837 raise HeaderDataError(
--> 838 'data dtype "%s" not recognized' % datatype)
839 dtype = self._data_type_codes.dtype[code]
840 # test for void, being careful of user-defined types
HeaderDataError: data dtype "float32" not recognized
/usr/local/python2.6.2/lib/python2.6/site-packages/nibabel/analyze.py(838)set_data_dtype()
837 raise HeaderDataError(
--> 838 'data dtype "%s" not recognized' % datatype)
839 dtype = self._data_type_codes.dtype[code]
This is due to it not passing 'np.float32', but instead passing dtype('float32') which is not in the _dtdefs.
Possible FIX? could add np.dtype(np.float32) to _dtdefs so these would pass...??