[Pkg-exppsy-pynifti] Converting NiftiImage to ndarray gives "ValueError: dimensions too large"
Nicholas Dowson
nick314 at hotmail.com
Fri Aug 7 05:29:26 UTC 2009
Hello,
The following code using pynifti gives me an error (ValueError: dimensions too large):
from nifti import *
from numpy import *
mynifti = NiftiImage('T1noise3bias0.nii')
myarray = mynifti.getDataArray()
This is very strange because the number of voxels is low:
In [11]: mynifti.nvox
Out[11]: 7109137
In [12]: mynifti.extent
Out[12]: (181, 217, 181)
Other information:
I am running Ubuntu 8.10, with the standard packages for python, numpy and scipy installed. I tried the above on ipython and python. Python just segfaults. I get the same error if I use getDataArray()
Here is the full output:
<BEGIN of output>
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (60, 0))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/dow178/extDownload/lib/VTKbuild/<ipython console> in <module>()
/var/lib/python-support/python2.5/nifti/niftiimage.pyc in asarray(self, copy)
217 """
218 # make sure data is accessible
--> 219 self.load()
220
221 if copy:
/var/lib/python-support/python2.5/nifti/niftiimage.pyc in load(self)
174 raise RuntimeError, "Unable to load image data."
175
--> 176 self._data = nifticlib.wrapImageDataWithArray(self.raw_nimg)
177
178
ValueError: dimensions too large.
<END of Output>
Does anyone know why this is occuring?
I tried installing the libnifti-dev package and searching for the wrapImageDataWithArray function to glean some information - but it doesn't live there. Any ideas where the c++ source code for wrapImageDataWithArray is?
Many thanks in advance,
Nick
_________________________________________________________________
Celebrate a decade of Messenger with free winks, emoticons, display pics, and more.
http://clk.atdmt.com/UKM/go/157562755/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pynifti/attachments/20090807/e95a7950/attachment.htm>
More information about the Pkg-exppsy-pynifti
mailing list