Skip to content

Commit 69e969b

Browse files
authored
Merge pull request #185 from christianbrodbeck/fix/remove_labels
[MRG] FIX Brain.remove labels()
2 parents 8648114 + 6affeab commit 69e969b

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

surfer/tests/test_viz.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from tempfile import mkdtemp, mktemp
66
import warnings
77

8-
from nose.tools import assert_equal
8+
from nose.tools import assert_equal, assert_in, assert_not_in
99
from mayavi import mlab
1010
import nibabel as nib
1111
import numpy as np
@@ -191,6 +191,14 @@ def test_label():
191191
brain.add_label("V1", color="steelblue", alpha=.6)
192192
brain.add_label("V2", color="#FF6347", alpha=.6)
193193
brain.add_label("entorhinal", color=(.2, 1, .5), alpha=.6)
194+
195+
# remove labels
196+
brain.remove_labels('V1')
197+
assert_in('V2', brain.labels_dict)
198+
assert_not_in('V1', brain.labels_dict)
199+
brain.remove_labels()
200+
assert_not_in('V2', brain.labels_dict)
201+
194202
brain.close()
195203

196204

surfer/viz.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1391,12 +1391,13 @@ def remove_labels(self, labels=None, hemi=None):
13911391
Labels to remove. Can be a string naming a single label, or None to
13921392
remove all labels. Possible names can be found in the Brain.labels
13931393
attribute.
1394-
hemi : str | None
1395-
If None, it is assumed to belong to the hemipshere being
1396-
shown. If two hemispheres are being shown, an error will
1397-
be thrown.
1394+
hemi : None
1395+
Deprecated parameter, do not use.
13981396
"""
1399-
hemi = self._check_hemi(hemi)
1397+
if hemi is not None:
1398+
warn("The `hemi` parameter to Brain.remove_labels() has no effect "
1399+
"and will be removed in PySurfer 0.9", DeprecationWarning)
1400+
14001401
if labels is None:
14011402
labels = self.labels_dict.keys()
14021403
elif isinstance(labels, str):

0 commit comments

Comments
 (0)