mne-tools/mne-python — pull request #1085 by christianmbrodbeck (2014-01-20 04:50:24+00:00)
Title: Split label

This is a function I wrote a while ago to split one label into two or more pieces (mainly for the temporal lobe aparc labels which are very long) which might be of general interest...?

```python
import os
import mne
import surfer

data_path = mne.datasets.sample.data_path(download=False)
label_fname = os.path.join(data_path, 'subjects', 'fsaverage', 'label', 'lh.BA1.label')

small_brain = dict(size=100, width=500, height=500)
brain = surfer.Brain('fsaverage', 'lh', 'inflated', config_opts=small_brain)

label = mne.read_label(label_fname)
l0, l1 = mne.split_label(label, source_space=None, axis='pca', pieces=2)
brain.add_label(l0, color=(1, 0, 0))
brain.add_label(l1, color=(1, 0.5, 0))
```
![test-split](https://f.cloud.github.com/assets/145771/1951728/0f6b7476-818e-11e3-8284-832e8090c6c4.png)