# Plotting a downsampled source space together with a	.label file

**URL:** <https://mne.discourse.group/t/plotting-a-downsampled-source-space-together-with-a-label-file/601>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [July 31, 2013, 10:01pm UTC](https://mne.discourse.group/t/plotting-a-downsampled-source-space-together-with-a-label-file/601 "2013-07-31T22:01:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [July 31, 2013, 10:01pm UTC](https://mne.discourse.group/t/plotting-a-downsampled-source-space-together-with-a-label-file/601/1 "2013-07-31T22:01:18Z")

</div>

Hello,

I am trying to plot a mesh of points from a sourcespace (e.g.,  
$SUBJECTS\_DIR/$SUBJECT/bem/$SUBJECT-ico-4-src.fif) together with the points  
in the label file. (the reason is because we made some custom labels using  
a script, and they turned out looking patchy–see  
[http://imgur.com/bUAuaJH--so](http://imgur.com/bUAuaJH--so) I want to check whether these labels really  
cover the whole regions they're supposed to, or whether there are  
sources/vertices that should be in those labels but aren't.) However, when  
I do this, the locations of the vertices from the label file don't quite  
line up with vertices from the source space (see  
[http://i.imgur.com/IGlKB9T.png](http://i.imgur.com/IGlKB9T.png) and [http://i.imgur.com/CUj6cF7.png](http://i.imgur.com/CUj6cF7.png) for  
comparisons; the green vertices from the label file are in more or less the  
right place [what's plotted here is Brodmann area 46], but don't quite line  
up with the black vertices from the source space), which I was surprised  
by, since I thought the locations of vertices in a label file came directly  
from the source space. What I was doing was reading the -ico-4-src.fif file  
into MATLAB using the FieldTrip toolbox, and reading a label file in  
directly, and then plotting them together.

So I am just wondering if there is a different file I should be using to  
plot the locations of all the vertices in my sourcespace that labels could  
have come from? Otherwise I guess it's a problem with how we created the  
labels.

Thank you,  
Steve Politzer-Ahles

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [July 31, 2013, 10:26pm UTC](https://mne.discourse.group/t/plotting-a-downsampled-source-space-together-with-a-label-file/601/2 "2013-07-31T22:26:12Z")

</div>

Hey Steve,

Offhand I see a couple possibilities. If you're referencing by vertex  
numbers, you might be hitting off-by-one errors somewhere, since MATLAB  
uses 1-based indexing, and surfaces / vertices are 0-index (C) based. If  
you upload the source space file and label file somewhere, someone (maybe  
me) might be able to track down what's going on. For what it's worth, if  
you have a working mne-python install, it uses 0-based indexing, and has  
useful functions for plotting brains with labels and the like. By OBO  
errors in my experience make usually result in worse errors, so that's  
probably not it.

If you're getting the positions directly from the label file, one thing you  
might want to check is the positions you get if you take the vertices  
referenced in the label file and use those to get positions in the source  
space. (In this case, be careful about the indexing...) Label files contain  
position values (what I have a feeling you're using to make the plots), but  
they also contain vertex numbers that those are meant to correspond to in  
source space. You might be hitting a problem where the label locations are  
pulled from one surface (e.g., pial), while the source space is defined  
over another (e.g., orig). I usually do my source-space manipulations using  
vertex numbers (instead of positions) to avoid this issue completely, as it  
treats all surfaces (e.g., pial, orig, sphere) equally.

Eric

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [August 2, 2013, 2:30pm UTC](https://mne.discourse.group/t/plotting-a-downsampled-source-space-together-with-a-label-file/601/3 "2013-08-02T14:30:04Z")

</div>

Thanks, that solved it! It was indeed the second issue; plotting my label  
by using the vertex numbers instead of the positions from the label file  
worked perfectly.

Best,  
Steve

Stephen Politzer-Ahles  
New York University, Abu Dhabi  
Psychology Department  
[http://files.nyu.edu/spa268/public](http://files.nyu.edu/spa268/public)
