Skip to content

ENH: Add FXAA option #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 14 additions & 8 deletions surfer/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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
----------
Expand All @@ -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'):
Expand Down Expand Up @@ -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'
Expand Down