The problem with saving morphed labels to an annot file

Dear group,

It seems like an old problem, but I couldn't find a reasonable solution,

When morphing labels from fsaverage to a subject, in most cases the annot file cannot be written due to vertices that belong to more than one label.

I've implemented several solutions, but in some cases, none of them gives a reasonable result.

Thanks,

Noam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180328/4f5c717d/attachment.html

hi Noam,

I personally don't have a solution for this. Maybe someone else?

could you provide a code snippet to replicate the pb?

Alex

Hey Alex,

Yes, sure!

You can find the code here:

https://github.com/pelednoam/mmvt/blob/master/src/misc/labels_morphing_problem.py

I'm using the Lausanne125 parcellation (http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0048121), but this problem can also be replicated using the aparc.DKTatlas40 atlas (or almost any other atlas I assume).

If you wish to run it with the Lausanne125 parcellation, the fsaverage annot files can be found here:

https://www.dropbox.com/sh/qvpvzf35konkwe5/AADVCp24TxLa_SBUSAAvCuFMa?dl=0

Thanks!

Noam

Hey Noam,

Does this code guarantee that the resulting morphed labels do not overlap?

Eric

Hey Eric,

No, I've just used label.morph() for each label from fsaverage to sample subject.

That is actually my question, if someone has a good approach to avoid these overlaps.

I'm using a naive approach (which also depends on the order of the labels) that uses a vertices->labels mapping:

for label in labels:
    for vertice in label.vertices:
        lookup[hemi][vertice] = labels_names.index(label.name)

And then set the labels vertices:

for vertice, label in lookup[hemi].items():
    labels_vertices[label].append(vertice)

I'm wondering if someone has implemented a better solution.

Thanks!

Noam