[Pkg-exppsy-pynifti] Converting NiftiImage to ndarray gives "ValueError: dimensions too large"

Michael Hanke michael.hanke at gmail.com
Fri Aug 7 11:27:27 UTC 2009


Hi Nicholas,

do you mind sharing the image, so I can check what is going on?


Michael


On Fri, Aug 07, 2009 at 05:29:26AM +0000, Nicholas Dowson wrote:
> 
> 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/

> _______________________________________________
> Pkg-exppsy-pynifti mailing list
> Pkg-exppsy-pynifti at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pynifti


-- 
GPG key:  1024D/3144BE0F Michael Hanke
http://apsy.gse.uni-magdeburg.de/hanke
ICQ: 48230050



More information about the Pkg-exppsy-pynifti mailing list