From 629c1181402ad475d189098d7a66e39e84780fe7 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 8 Jun 2020 10:36:48 -0400 Subject: [PATCH 1/2] ENH: Add FXAA option --- surfer/viz.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/surfer/viz.py b/surfer/viz.py index f0af97d..014b19a 100644 --- a/surfer/viz.py +++ b/surfer/viz.py @@ -190,7 +190,7 @@ def _force_render(figures): def _make_viewer(figure, n_row, n_col, title, scene_size, offscreen, - interaction='trackball'): + interaction='trackball', antialias=True): """Triage viewer creation 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, for f in figure: f.scene.interactor.interactor_style = \ tvtk.InteractorStyleTerrain() - for figure in figures: - for f in figure: - # on a non-testing backend, and using modern VTK/Mayavi - if hasattr(getattr(f.scene, 'renderer', None), 'use_fxaa'): - f.scene.renderer.use_fxaa = True + if antialias: + for figure in figures: + for f in figure: + # on a non-testing backend, and using modern VTK/Mayavi + if hasattr(getattr(f.scene, 'renderer', None), + 'use_fxaa'): + f.scene.renderer.use_fxaa = True else: if isinstance(figure, int): # use figure with specified id figure = [mlab.figure(figure, size=scene_size)] @@ -374,6 +376,9 @@ class Brain(object): camera. units : str Can be 'm' or 'mm' (default). + antialias : bool + If True (default), turn on antialiasing. Can be problematic for + some renderers (e.g., software rendering with MESA). Attributes ---------- @@ -397,7 +402,8 @@ def __init__(self, subject_id, hemi, surf, title=None, cortex="classic", alpha=1.0, size=800, background="black", foreground=None, figure=None, subjects_dir=None, views=['lat'], offset=True, show_toolbar=False, - offscreen='auto', interaction='trackball', units='mm'): + offscreen='auto', interaction='trackball', units='mm', + antialias=True): if not isinstance(interaction, string_types) or \ interaction not in ('trackball', 'terrain'): @@ -448,7 +454,7 @@ def __init__(self, subject_id, hemi, surf, title=None, del background, foreground figures, _v = _make_viewer(figure, n_row, n_col, title, self._scene_size, offscreen, - interaction) + interaction, antialias) self._figures = figures self._v = _v self._window_backend = 'Mayavi' if self._v is None else 'TraitsUI' From 82c2c30cafc62080e3faa96aa61e38a756b3957d Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 11 Jun 2020 11:44:31 -0400 Subject: [PATCH 2/2] FIX: Mayavi for VTK9 --- appveyor.yml | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 39520c5..edf1435 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ install: - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - "python --version" - "pip install numpy scipy matplotlib nose pillow pytest pytest-cov pytest-faulthandler coverage imageio imageio-ffmpeg codecov pyqt5==5.9" - - "pip install traits traitsui pyface vtk mayavi nibabel" + - "pip install traits traitsui pyface vtk https://github.com/enthought/mayavi/archive/master.zip nibabel" - "powershell make/get_fsaverage.ps1" - "python setup.py develop" - "SET SUBJECTS_DIR=%CD%\\subjects" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7d98a8e..bb560b7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,7 +30,7 @@ jobs: displayName: Cache pip packages - powershell: | pip install numpy scipy matplotlib nose pillow pytest pytest-cov pytest-faulthandler coverage imageio imageio-ffmpeg codecov pyqt5==5.9 --cache-dir $(PIP_CACHE_FOLDER) - pip install traits traitsui pyface vtk mayavi nibabel --cache-dir $(PIP_CACHE_FOLDER) + pip install traits traitsui pyface vtk https://github.com/enthought/mayavi/archive/master.zip nibabel --cache-dir $(PIP_CACHE_FOLDER) displayName: 'Install pip dependencies' - powershell: | powershell make/get_fsaverage.ps1