@@ -190,7 +190,7 @@ def _force_render(figures):
190190
191191
192192def _make_viewer (figure , n_row , n_col , title , scene_size , offscreen ,
193- interaction = 'trackball' ):
193+ interaction = 'trackball' , antialias = True ):
194194 """Triage viewer creation
195195
196196 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,
229229 for f in figure :
230230 f .scene .interactor .interactor_style = \
231231 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
237239 else :
238240 if isinstance (figure , int ): # use figure with specified id
239241 figure = [mlab .figure (figure , size = scene_size )]
@@ -374,6 +376,9 @@ class Brain(object):
374376 camera.
375377 units : str
376378 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).
377382
378383 Attributes
379384 ----------
@@ -397,7 +402,8 @@ def __init__(self, subject_id, hemi, surf, title=None,
397402 cortex = "classic" , alpha = 1.0 , size = 800 , background = "black" ,
398403 foreground = None , figure = None , subjects_dir = None ,
399404 views = ['lat' ], offset = True , show_toolbar = False ,
400- offscreen = 'auto' , interaction = 'trackball' , units = 'mm' ):
405+ offscreen = 'auto' , interaction = 'trackball' , units = 'mm' ,
406+ antialias = True ):
401407
402408 if not isinstance (interaction , string_types ) or \
403409 interaction not in ('trackball' , 'terrain' ):
@@ -448,7 +454,7 @@ def __init__(self, subject_id, hemi, surf, title=None,
448454 del background , foreground
449455 figures , _v = _make_viewer (figure , n_row , n_col , title ,
450456 self ._scene_size , offscreen ,
451- interaction )
457+ interaction , antialias )
452458 self ._figures = figures
453459 self ._v = _v
454460 self ._window_backend = 'Mayavi' if self ._v is None else 'TraitsUI'
0 commit comments