def test_io_bem_surfaces(): """Testing reading of bem surfaces """ surf = read_bem_surfaces(fname, add_geom=True) surf = read_bem_surfaces(fname, add_geom=False) print "Number of surfaces : %d" % len(surf) write_bem_surface('bem_surf.fif', surf[0]) surf_read = read_bem_surfaces('bem_surf.fif', add_geom=False) for key in surf[0].keys(): assert_array_almost_equal(surf[0][key], surf_read[0][key])
def test_io_bem_surfaces(): """Test reading of bem surfaces """ tempdir = _TempDir() surf = read_bem_surfaces(fname, add_geom=True) surf = read_bem_surfaces(fname, add_geom=False) print("Number of surfaces : %d" % len(surf)) write_bem_surface(op.join(tempdir, 'bem_surf.fif'), surf[0]) surf_read = read_bem_surfaces(op.join(tempdir, 'bem_surf.fif'), add_geom=False) for key in surf[0].keys(): assert_array_almost_equal(surf[0][key], surf_read[0][key])
def run(): from mne.commands.utils import get_optparser parser = get_optparser(__file__) parser.add_option("-s", "--surf", dest="surf", help="Surface in Freesurfer format", metavar="FILE") parser.add_option("-f", "--fif", dest="fif", help="FIF file produced", metavar="FILE") parser.add_option("-i", "--id", dest="id", default=4, help=("Surface Id (e.g. 4 sur head surface)")) options, args = parser.parse_args() if options.surf is None: parser.print_help() sys.exit(1) print("Converting %s to BEM FIF file." % options.surf) points, tris = mne.read_surface(options.surf) points *= 1e-3 surf = dict(coord_frame=5, id=int(options.id), nn=None, np=len(points), ntri=len(tris), rr=points, sigma=1, tris=tris) mne.write_bem_surface(options.fif, surf)
import sys import mne if __name__ == '__main__': from mne.commands.utils import get_optparser parser = get_optparser(__file__) parser.add_option("-s", "--surf", dest="surf", help="Surface in Freesurfer format", metavar="FILE") parser.add_option("-f", "--fif", dest="fif", help="FIF file produced", metavar="FILE") parser.add_option("-i", "--id", dest="id", default=4, help=("Surface Id (e.g. 4 sur head surface)")) options, args = parser.parse_args() if options.surf is None: parser.print_help() sys.exit(1) print("Converting %s to BEM FIF file." % options.surf) points, tris = mne.read_surface(options.surf) points *= 1e-3 surf = dict(coord_frame=5, id=int(options.id), nn=None, np=len(points), ntri=len(tris), rr=points, sigma=1, tris=tris) mne.write_bem_surface(options.fif, surf)