@testing.requires_testing_data
def test_io_surface():
 tempdir = _TempDir()
 fname_quad = op.join(data_path, 'subjects', 'bert', 'surf', 'lh.inflated.nofix')
 fname_tri = op.join(data_path, 'subjects', 'fsaverage', 'surf', 'lh.inflated')
 for fname in (fname_quad, fname_tri):
  with warnings.catch_warnings(record=True) as w:
   (pts, tri, vol_info) = read_surface(fname, read_metadata=True)
  assert_true(all((('No volume info' in str(ww.message)) for ww in w)))
  write_surface(op.join(tempdir, 'tmp'), pts, tri, volume_info=vol_info)
  with warnings.catch_warnings(record=True) as w:
   (c_pts, c_tri, c_vol_info) = read_surface(op.join(tempdir, 'tmp'), read_metadata=True)
  assert_array_equal(pts, c_pts)
  assert_array_equal(tri, c_tri)
  assert_equal(object_diff(vol_info, c_vol_info), '')

@ testing . requires_testing_data def test_io_surface ( ) : tempdir = _TempDir ( ) fname_quad = op . join ( data_path , 'subjects' , 'bert' , 'surf' , 'lh.inflated.nofix' ) fname_tri = op . join ( data_path , 'subjects' , 'fsaverage' , 'surf' , 'lh.inflated' ) for fname in ( fname_quad , fname_tri ) : with warnings . catch_warnings ( record = True ) as w : ( pts , tri , vol_info ) = read_surface ( fname , read_metadata = True ) assert_true ( all ( ( ( 'No volume info' in str ( ww . message ) ) for ww in w ) ) ) write_surface ( op . join ( tempdir , 'tmp' ) , pts , tri , volume_info = vol_info ) with warnings . catch_warnings ( record = True ) as w : ( c_pts , c_tri , c_vol_info ) = read_surface ( op . join ( tempdir , 'tmp' ) , read_metadata = True ) assert_array_equal ( pts , c_pts ) assert_array_equal ( tri , c_tri ) assert_equal ( object_diff ( vol_info , c_vol_info ) , '' )
test reading and writing of freesurfer surface mesh files .