Repository: mne-tools/mne-python

Issue:
TVTK requirement for building high res surfs
Running `mne make_scalp_surfaces` on a Mac, I get

```
3. Creating medium tessellation...
3.1 Decimating the dense tessellation...
Traceback (most recent call last):
  File "/Users/jona/anaconda3/envs/py2/lib/python2.7/site-packages/mne-0.13.dev0-py2.7.egg/mne/commands/mne_make_scalp_surfaces.py", line 144, in <module>
    run()
  File "/Users/jona/anaconda3/envs/py2/lib/python2.7/site-packages/mne-0.13.dev0-py2.7.egg/mne/commands/mne_make_scalp_surfaces.py", line 56, in run
    options.verbose)
  File "<string>", line 2, in _run
  File "/Users/jona/anaconda3/envs/py2/lib/python2.7/site-packages/mne-0.13.dev0-py2.7.egg/mne/utils.py", line 667, in verbose
    return function(*args, **kwargs)
  File "/Users/jona/anaconda3/envs/py2/lib/python2.7/site-packages/mne-0.13.dev0-py2.7.egg/mne/commands/mne_make_scalp_surfaces.py", line 127, in _run
    n_triangles=n_tri)
  File "/Users/jona/anaconda3/envs/py2/lib/python2.7/site-packages/mne-0.13.dev0-py2.7.egg/mne/surface.py", line 834, in decimate_surface
    return _decimate_surface(points, triangles, reduction)
  File "/Users/jona/anaconda3/envs/py2/lib/python2.7/site-packages/mne-0.13.dev0-py2.7.egg/mne/surface.py", line 791, in _decimate_surface
    raise ValueError('This function requires the TVTK package to be '
ValueError: This function requires the TVTK package to be installed
```



Discussion:
This should only happen if decimation is requested, I'll fix it

...looks like decimation is mandatory, I'll probably make an argument to supply the decimation levels

Or since they're called "medium" and "sparse", maybe just `--nodecimate` would do it


Resolving patch:
diff --git a/mne/commands/mne_make_scalp_surfaces.py b/mne/commands/mne_make_scalp_surfaces.py
--- a/mne/commands/mne_make_scalp_surfaces.py
+++ b/mne/commands/mne_make_scalp_surfaces.py
@@ -44,7 +44,9 @@ def run():
                       help='Print the debug messages.')
     parser.add_option("-d", "--subjects-dir", dest="subjects_dir",
                       help="Subjects directory", default=subjects_dir)
-
+    parser.add_option("-n", "--no-decimate", dest="no_decimate",
+                      help="Disable medium and sparse decimations "
+                      "(dense only)", action='store_true')
     options, args = parser.parse_args()
 
     subject = vars(options).get('subject', os.getenv('SUBJECT'))
@@ -52,12 +54,13 @@ def run():
     if subject is None or subjects_dir is None:
         parser.print_help()
         sys.exit(1)
+    print(options.no_decimate)
     _run(subjects_dir, subject, options.force, options.overwrite,
-         options.verbose)
+         options.no_decimate, options.verbose)
 
 
 @verbose
-def _run(subjects_dir, subject, force, overwrite, verbose=None):
+def _run(subjects_dir, subject, force, overwrite, no_decimate, verbose=None):
     this_env = copy.copy(os.environ)
     this_env['SUBJECTS_DIR'] = subjects_dir
     this_env['SUBJECT'] = subject
@@ -115,7 +118,7 @@ def check_seghead(surf_path=op.join(subj_path, 'surf')):
                     '--fif', dense_fname], env=this_env)
     levels = 'medium', 'sparse'
     my_surf = mne.read_bem_surfaces(dense_fname)[0]
-    tris = [30000, 2500]
+    tris = [] if no_decimate else [30000, 2500]
     if os.getenv('_MNE_TESTING_SCALP', 'false') == 'true':
         tris = [len(my_surf['tris'])]  # don't actually decimate
     for ii, (n_tri, level) in enumerate(zip(tris, levels), 3):


Test patch:
diff --git a/mne/commands/tests/test_commands.py b/mne/commands/tests/test_commands.py
--- a/mne/commands/tests/test_commands.py
+++ b/mne/commands/tests/test_commands.py
@@ -123,7 +123,8 @@ def test_make_scalp_surfaces():
     surf_path_new = op.join(tempdir, 'sample', 'surf')
     os.mkdir(op.join(tempdir, 'sample'))
     os.mkdir(surf_path_new)
-    os.mkdir(op.join(tempdir, 'sample', 'bem'))
+    subj_dir = op.join(tempdir, 'sample', 'bem')
+    os.mkdir(subj_dir)
     shutil.copy(op.join(surf_path, 'lh.seghead'), surf_path_new)
 
     orig_fs = os.getenv('FREESURFER_HOME', None)
@@ -140,6 +141,8 @@ def test_make_scalp_surfaces():
             assert_raises(RuntimeError, mne_make_scalp_surfaces.run)
             os.environ['MNE_ROOT'] = orig_mne
             mne_make_scalp_surfaces.run()
+            assert_true(op.isfile(op.join(subj_dir, 'sample-head-dense.fif')))
+            assert_true(op.isfile(op.join(subj_dir, 'sample-head-medium.fif')))
             assert_raises(IOError, mne_make_scalp_surfaces.run)  # no overwrite
     finally:
         if orig_fs is not None: