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

Gael Varoquaux michael.hanke at gmail.com
Tue Dec 30 14:44:48 UTC 2008


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.

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

mask is a mask that was created using::

    nifti.NiftiImage(mask.astype(N.int), rmask.header).save(join(working_dir,
                                                'mask_all_subjects.nii'))

It loads OK in anatomist, so I suppose it is a valid nifti.

The segfault happens after the 'print "alive"'. I can also trigger it
using "mask.sum()" instead of "print mask" or pretty much anything that
accesses the values of mask.

However, I can most often avoid the crash using

   mask = nifti.NiftiImage(join(working_dir, 'mask_all_subjects.nii')
                                        ).getDataArray().copy()

to load.

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 can find a way to send you the mask file if you can't reproduce the
bug.

Thanks,

Gaël



More information about the Pkg-exppsy-pynifti mailing list