[Pkg-exppsy-pynifti] pynifti ref-count bugs?

Michael Hanke michael.hanke at gmail.com
Tue Dec 30 14:45:19 UTC 2008


Hey Gael,

On Wed, Oct 08, 2008 at 10:56:37AM +0200, Gael Varoquaux wrote:
> Hi Michael,
> 
> Is there a mailing list for pyNifti? I am sending this e-mail directly to
> you, but maybe it is the wrong thing to do.
Nah, that is fine. I usually refer people to

pkg-exppsy-pymvpa at lists.alioth.debian.org

which is not just for pynifti, but a place with a public archive and
usually preferable to private emails (in the long run) ;-)

> I am having segfaults with pynifti that resemble a lot ref-count bugs.
> 
> There are many ways to trigger them, here is an example::
> 
>     from os.path import join
>     import nifti
>     working_dir = '/tmp/full_run2'
>     mask = nifti.NiftiImage(join(working_dir, 'mask_all_subjects.nii')
> 					).getDataArray()
>     print "alive"
>     print mask
The file should be correct, but the way you access the array causes
trouble. getDataArray() simply returns a pointer to the data allocated
by the nifti library. As you do not store the nifti image itself, that
data is destroyed immediately, hence segfault when accessing it.

Just replace getDataArray() (or simply .data) with asarray(), which has
a parameter 'copy' that is True by default.

> I am running a git latest version of pynifti. As far as I can tell, I am
> running a 1.1.0 version of nifticlib (I can't find an obvious indication
> of the version number, but the last entry in the Updates.txt is 1.1.0),
> compiled from source. The system is a Mandriva (I don't have an option,
> there :( ).
I recently started compiling RPM packages with the OpenSUSE build
service. I am a total novice to RPM, but I also have them for Mandriva
2007 and 2008 -- including packages for nifticlibs. I'd be glad, if you
could try them and tell me if they work

http://download.opensuse.org/repositories/home:/hankem/

or

http://software.opensuse.org/search?baseproject=Mandriva%3A2008&p=1&q=python-nifti


Cheers,

Michael


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



More information about the Pkg-exppsy-pynifti mailing list