[Pkg-exppsy-pynifti] Converting NiftiImage to ndarray gives "ValueError: dimensions too large"
Nicholas Dowson
nick314 at hotmail.com
Sun Aug 16 23:14:54 UTC 2009
Michael: Thank you for your speed of response and apologies for taking so long to reply.
Here is another (small) file of a 4x4x4 cube. The same code causes a segmentation fault (repeated for ease of copy-paste)
from nifti import *
from numpy import *
mynifti = NiftiImage('test4x4x4.nii')
myarray = mynifti.getDataArray()
myarray
Thanks, Nick
> Date: Fri, 7 Aug 2009 07:27:27 -0400
> From: michael.hanke at gmail.com
> To: nick314 at hotmail.com
> CC: pkg-exppsy-pynifti at lists.alioth.debian.org
> Subject: Re: [Pkg-exppsy-pynifti] Converting NiftiImage to ndarray gives "ValueError: dimensions too large"
>
> 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
_________________________________________________________________
Windows Live Messenger: Happy 10-Year Anniversary—get free winks and emoticons.
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/20090816/e1536dd7/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test4x4x4.nii
Type: application/octet-stream
Size: 608 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pynifti/attachments/20090816/e1536dd7/attachment.obj>
More information about the Pkg-exppsy-pynifti
mailing list