[Neuroimaging] Bug in reading freesurfer annotation in nibabel?

Satrajit Ghosh satra at mit.edu
Tue Feb 21 08:11:39 EST 2017


hi gael,

seems like a corrupted file. with the same routine i read an annot a2005s,
and two different a2009s from recent data.

the annot files store indexed values aligned with the surfaces (e.g.,
lh.pial, lh.white) and in addition can store a color table. the annot value
itself is an rgb that's bit combined into an integer.

details here:
https://surfer.nmr.mgh.harvard.edu/fswiki/LabelsClutsAnnotationFiles#Annotationfile

cheers,

satra

On Tue, Feb 21, 2017 at 7:57 AM, Gael Varoquaux <
gael.varoquaux at normalesup.org> wrote:

> Hi,
>
> I am trying to load the freesurfer Destrieux atlas annotation file:
> right.aparc.a2009s.annot
> and I get the following error:
>
> In [2]: import nibabel as nb
>
> In [3]:
> nb.freesurfer.read_annot('/home/varoquau/nilearn_data/
> destrieux_surface/left.aparc.a2009s.annot')
> ------------------------------------------------------------
> ---------------
> IndexError                                Traceback (most recent call
> last)
> <ipython-input-3-610fc2be58c1> in <module>()
> ----> 1
> nb.freesurfer.read_annot('/home/varoquau/nilearn_data/
> destrieux_surface/left.aparc.a2009s.annot')
>
> /home/varoquau/dev/nibabel/nibabel/freesurfer/io.pyc in
> read_annot(filepath, orig_ids)
>     320     with open(filepath, "rb") as fobj:
>     321         dt = ">i4"
> --> 322         vnum = np.fromfile(fobj, dt, 1)[0]
>     323         data = np.fromfile(fobj, dt, vnum * 2).reshape(vnum, 2)
>     324         labels = data[:, 1]
>
> IndexError: index 0 is out of bounds for axis 0 with size 0
>
> Same failure for the right annotation (with nibabel 2.1 or master).
>
> Am I doing something wrong (eg file corrupted) or are people having the
> same problem? This is a naive question: I know nothing about surfaces.
>
> Cheers,
>
> Gaël
>
> --
>     Gael Varoquaux
>     Researcher, INRIA Parietal
>     NeuroSpin/CEA Saclay , Bat 145, 91191 Gif-sur-Yvette France
>     Phone:  ++ 33-1-69-08-79-68
>     http://gael-varoquaux.info            http://twitter.com/GaelVaroquaux
> _______________________________________________
> Neuroimaging mailing list
> Neuroimaging at python.org
> https://mail.python.org/mailman/listinfo/neuroimaging
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20170221/4a3f350a/attachment.html>


More information about the Neuroimaging mailing list