Skip to content

Commit 6d8685c

Browse files
authored
MRG: Fix label colors (#229)
* FIX: Label colors * FIX: Nicks fix is better * ENH: Bump to VTK from pip * FIX: Travis
1 parent 5c30544 commit 6d8685c

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

environment.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
name: mne
22
channels:
33
- defaults
4-
- clinicalgraphics # Needed for VTK
54
dependencies:
6-
- python=3.6.1
5+
- python>=3.6
76
- pip
87
- mkl
98
- numpy
109
- scipy
1110
- matplotlib
1211
- pyqt=5
13-
- vtk>=7
1412
- nose
1513
- coverage
1614
- pytest
1715
- pytest-cov
1816
- flake8
1917
- pygments
2018
- pip:
19+
- vtk
2120
- "git+https://github.com/enthought/traits.git@a7a83182048c08923953e302658b51b68c802132"
2221
- "git+https://github.com/enthought/pyface.git@13a064de48adda3c880350545717d8cf8929afad"
2322
- "git+https://github.com/enthought/traitsui.git@ee8ef0a34dfc1db18a8e2c0301cc18d96b7a3e2f"

examples/plot_label.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
brain.add_label("BA1_exvivo", color="blue", scalar_thresh=.5)
2727

2828
# Or you can give a path to a label in an arbitrary location
29-
subj_dir = os.environ["SUBJECTS_DIR"]
29+
subj_dir = brain.subjects_dir
3030
label_file = os.path.join(subj_dir, subject_id,
3131
"label", "%s.MT_exvivo.label" % hemi)
3232
brain.add_label(label_file)

surfer/tests/test_viz.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ def test_image():
8181
brain.close()
8282

8383
brain = Brain(*std_args, size=100)
84+
if sys.platform == 'darwin' and os.getenv('TRAVIS', '') == 'true':
85+
raise SkipTest('image saving on OSX travis is not supported')
8486
brain.save_image(tmp_name)
8587
brain.save_image(tmp_name, 'rgba', True)
8688
brain.screenshot()
87-
if not os.getenv('TRAVIS', 'false') == 'true':
89+
if os.getenv('TRAVIS', '') != 'true':
8890
# for some reason these fail on Travis sometimes
8991
brain.save_montage(tmp_name, ['l', 'v', 'm'], orientation='v')
9092
brain.save_montage(tmp_name, ['l', 'v', 'm'], orientation='h')
@@ -340,6 +342,8 @@ def test_movie():
340342
smoothing_steps=10, time=time, time_label='time=%0.2f ms')
341343
brain.scale_data_colormap(fmin=13, fmid=18, fmax=22, transparent=True)
342344

345+
if sys.platform == 'darwin' and os.getenv('TRAVIS', '') == 'true':
346+
raise SkipTest('movie saving on OSX Travis is not supported')
343347
# save movies with different options
344348
tempdir = mkdtemp()
345349
try:

surfer/viz.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3257,7 +3257,10 @@ def add_label(self, label, label_name, color, alpha):
32573257
color = colorConverter.to_rgba(color, alpha)
32583258
cmap = np.array([(0, 0, 0, 0,), color])
32593259
l_m = surf.module_manager.scalar_lut_manager
3260-
l_m.load_lut_from_list(cmap)
3260+
# for some reason (traits?) using `load_lut_from_list` here does
3261+
# not work (.data_range needs to be tweaked in this case),
3262+
# but setting the table directly does:
3263+
l_m.lut.table = np.round(cmap * 255).astype(np.uint8)
32613264
return array_id, surf
32623265

32633266
def add_morphometry(self, morph_data, colormap, measure,

0 commit comments

Comments
 (0)