@@ -190,7 +190,7 @@ def _force_render(figures):
190
190
191
191
192
192
def _make_viewer (figure , n_row , n_col , title , scene_size , offscreen ,
193
- interaction = 'trackball' ):
193
+ interaction = 'trackball' , antialias = True ):
194
194
"""Triage viewer creation
195
195
196
196
If n_row == n_col == 1, then we can use a Mayavi figure, which
@@ -229,11 +229,13 @@ def _make_viewer(figure, n_row, n_col, title, scene_size, offscreen,
229
229
for f in figure :
230
230
f .scene .interactor .interactor_style = \
231
231
tvtk .InteractorStyleTerrain ()
232
- for figure in figures :
233
- for f in figure :
234
- # on a non-testing backend, and using modern VTK/Mayavi
235
- if hasattr (getattr (f .scene , 'renderer' , None ), 'use_fxaa' ):
236
- f .scene .renderer .use_fxaa = True
232
+ if antialias :
233
+ for figure in figures :
234
+ for f in figure :
235
+ # on a non-testing backend, and using modern VTK/Mayavi
236
+ if hasattr (getattr (f .scene , 'renderer' , None ),
237
+ 'use_fxaa' ):
238
+ f .scene .renderer .use_fxaa = True
237
239
else :
238
240
if isinstance (figure , int ): # use figure with specified id
239
241
figure = [mlab .figure (figure , size = scene_size )]
@@ -374,6 +376,9 @@ class Brain(object):
374
376
camera.
375
377
units : str
376
378
Can be 'm' or 'mm' (default).
379
+ antialias : bool
380
+ If True (default), turn on antialiasing. Can be problematic for
381
+ some renderers (e.g., software rendering with MESA).
377
382
378
383
Attributes
379
384
----------
@@ -397,7 +402,8 @@ def __init__(self, subject_id, hemi, surf, title=None,
397
402
cortex = "classic" , alpha = 1.0 , size = 800 , background = "black" ,
398
403
foreground = None , figure = None , subjects_dir = None ,
399
404
views = ['lat' ], offset = True , show_toolbar = False ,
400
- offscreen = 'auto' , interaction = 'trackball' , units = 'mm' ):
405
+ offscreen = 'auto' , interaction = 'trackball' , units = 'mm' ,
406
+ antialias = True ):
401
407
402
408
if not isinstance (interaction , string_types ) or \
403
409
interaction not in ('trackball' , 'terrain' ):
@@ -448,7 +454,7 @@ def __init__(self, subject_id, hemi, surf, title=None,
448
454
del background , foreground
449
455
figures , _v = _make_viewer (figure , n_row , n_col , title ,
450
456
self ._scene_size , offscreen ,
451
- interaction )
457
+ interaction , antialias )
452
458
self ._figures = figures
453
459
self ._v = _v
454
460
self ._window_backend = 'Mayavi' if self ._v is None else 'TraitsUI'
0 commit comments