<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Michael: Thank you for your speed of response and apologies for taking so long to reply.<br><br>Here is another (small) file of a 4x4x4 cube.&nbsp; The same code causes a segmentation fault (repeated for ease of copy-paste)<br>from nifti import *<br>from numpy import *<br>mynifti = NiftiImage('test4x4x4.nii')<br>myarray = mynifti.getDataArray()<br>myarray<br><br>Thanks, Nick<br><br><br>&gt; Date: Fri, 7 Aug 2009 07:27:27 -0400<br>&gt; From: michael.hanke@gmail.com<br>&gt; To: nick314@hotmail.com<br>&gt; CC: pkg-exppsy-pynifti@lists.alioth.debian.org<br>&gt; Subject: Re: [Pkg-exppsy-pynifti] Converting NiftiImage to ndarray gives "ValueError: dimensions too large"<br>&gt; <br>&gt; Hi Nicholas,<br>&gt; <br>&gt; do you mind sharing the image, so I can check what is going on?<br>&gt; <br>&gt; <br>&gt; Michael<br>&gt; <br>&gt; <br>&gt; On Fri, Aug 07, 2009 at 05:29:26AM +0000, Nicholas Dowson wrote:<br>&gt; &gt; <br>&gt; &gt; Hello,<br>&gt; &gt; <br>&gt; &gt; The following code using pynifti gives me an error (ValueError: dimensions too large):<br>&gt; &gt; from nifti import *<br>&gt; &gt; from numpy import *<br>&gt; &gt; mynifti = NiftiImage('T1noise3bias0.nii')<br>&gt; &gt; myarray = mynifti.getDataArray()<br>&gt; &gt; <br>&gt; &gt; This is very strange because the number of voxels is low:<br>&gt; &gt; In [11]: mynifti.nvox<br>&gt; &gt; Out[11]: 7109137<br>&gt; &gt; In [12]: mynifti.extent<br>&gt; &gt; Out[12]: (181, 217, 181)<br>&gt; &gt; <br>&gt; &gt; Other information:<br>&gt; &gt; 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()<br>&gt; &gt; <br>&gt; &gt; Here is the full output:<br>&gt; &gt; &lt;BEGIN of output&gt;<br>&gt; &gt; ERROR: An unexpected error occurred while tokenizing input<br>&gt; &gt; The following traceback may be corrupted or invalid<br>&gt; &gt; The error message is: ('EOF in multi-line statement', (60, 0))<br>&gt; &gt; <br>&gt; &gt; ---------------------------------------------------------------------------<br>&gt; &gt; ValueError                                Traceback (most recent call last)<br>&gt; &gt; <br>&gt; &gt; /home/dow178/extDownload/lib/VTKbuild/&lt;ipython console&gt; in &lt;module&gt;()<br>&gt; &gt; <br>&gt; &gt; /var/lib/python-support/python2.5/nifti/niftiimage.pyc in asarray(self, copy)<br>&gt; &gt;     217         """<br>&gt; &gt;     218         # make sure data is accessible<br>&gt; &gt; --&gt; 219         self.load()<br>&gt; &gt;     220 <br>&gt; &gt;     221         if copy:<br>&gt; &gt; <br>&gt; &gt; /var/lib/python-support/python2.5/nifti/niftiimage.pyc in load(self)<br>&gt; &gt;     174             raise RuntimeError, "Unable to load image data."<br>&gt; &gt;     175 <br>&gt; &gt; --&gt; 176         self._data = nifticlib.wrapImageDataWithArray(self.raw_nimg)<br>&gt; &gt;     177 <br>&gt; &gt;     178 <br>&gt; &gt; <br>&gt; &gt; ValueError: dimensions too large.<br>&gt; &gt; <br>&gt; &gt;  &lt;END of Output&gt;<br>&gt; &gt; <br>&gt; &gt; Does anyone know why this is occuring?<br>&gt; &gt; <br>&gt; &gt; 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?<br>&gt; &gt; <br>&gt; &gt; Many thanks in advance,<br>&gt; &gt; Nick<br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; _________________________________________________________________<br>&gt; &gt; Celebrate a decade of Messenger with free winks, emoticons, display pics, and more.<br>&gt; &gt; http://clk.atdmt.com/UKM/go/157562755/direct/01/<br>&gt; <br>&gt; &gt; _______________________________________________<br>&gt; &gt; Pkg-exppsy-pynifti mailing list<br>&gt; &gt; Pkg-exppsy-pynifti@lists.alioth.debian.org<br>&gt; &gt; http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pynifti<br>&gt; <br>&gt; <br>&gt; -- <br>&gt; GPG key:  1024D/3144BE0F Michael Hanke<br>&gt; http://apsy.gse.uni-magdeburg.de/hanke<br>&gt; ICQ: 48230050<br><br /><hr />Windows Live Messenger: Happy 10-Year Anniversary—get free winks and emoticons. <a href='http://clk.atdmt.com/UKM/go/157562755/direct/01/' target='_new'>Get Them Now</a></body>
</html>