docs: def save_surface_files(note, error, registrations, subject,
                         no_surf_export, no_reg_export, surface_format, surface_path,
                         angle_tag, eccen_tag, label_tag, radius_tag, registration_name):
      '''
      save_surface_files is the calculator that saves the registration data out as surface files,
      which are put back in the registration as the value 'surface_files'.
      '''
      if no_surf_export: return {'surface_files': ()}
      surface_format = surface_format.lower()
      # make an exporter for properties:
      if surface_format in ['curv', 'morph', 'auto', 'automatic']:
          def export(flnm, p):
              fsio.write_morph_data(flnm, p)
              return flnm
      elif surface_format in ['mgh', 'mgz']:
          def export(flnm, p):
              flnm = flnm + '.' + surface_format
              dt = np.int32 if np.issubdtype(p.dtype, np.dtype(int).type) else np.float32
              img = fsmgh.MGHImage(np.asarray([[p]], dtype=dt), np.eye(4))
              img.to_filename(flnm)
              return flnm
      elif surface_format in ['nifti', 'nii', 'niigz', 'nii.gz']:
          surface_format = 'nii' if surface_format == 'nii' else 'nii.gz'
          def export(flnm, p):
              flnm = flnm + '.' + surface_format
              dt = np.int32 if np.issubdtype(p.dtype, np.dtype(int).type) else np.float32
              img = nib.Nifti1Image(np.asarray([[p]], dtype=dt), np.eye(4))
              img.to_filename(flnm)
              return flnm
      else:
          error('Could not understand surface file-format %s' % surface_format)
      path = surface_path if surface_path else os.path.join(subject.path, 'surf')
      files = []
      note('Exporting files...')
      for h in six.iterkeys(registrations):
          hemi = subject.hemis[h]
          reg = registrations[h]
          note('Extracting %s predicted mesh...' % h.upper())
          pmesh = reg['predicted_mesh']
          for (pname,tag) in zip(['polar_angle', 'eccentricity', 'visual_area', 'radius'],
                                 [angle_tag, eccen_tag, label_tag, radius_tag]):
              flnm = export(os.path.join(path, h + '.' + tag), pmesh.prop(pname))
              files.append(flnm)
          # last do the registration itself
          if registration_name and not no_reg_export:
              flnm = os.path.join(path, h + '.' + registration_name + '.sphere.reg')
              fsio.write_geometry(flnm, pmesh.coordinates.T, pmesh.tess.faces.T)
      return {'surface_files': tuple(files)}