def _get_annot_fname(annot_fname, subject, hemi, parc, subjects_dir):
 if (annot_fname is not None):
  hemis = [op.basename(annot_fname)[:2]]
  if (hemis[0] not in ['lh', 'rh']):
   raise ValueError('Could not determine hemisphere from filename, filename has to start with "lh" or "rh".')
  annot_fname = [annot_fname]
 else:
  if (hemi not in ['lh', 'rh', 'both']):
   raise ValueError('hemi has to be "lh", "rh", or "both"')
  if (hemi == 'both'):
   hemis = ['lh', 'rh']
  else:
   hemis = [hemi]
  subjects_dir = get_subjects_dir(subjects_dir, raise_error=True)
  dst = op.join(subjects_dir, subject, 'label', ('%%s.%s.annot' % parc))
  annot_fname = [(dst % hemi_) for hemi_ in hemis]
 return (annot_fname, hemis)

def _get_annot_fname ( annot_fname , subject , hemi , parc , subjects_dir ) : if ( annot_fname is not None ) : hemis = [ op . basename ( annot_fname ) [ : 2 ] ] if ( hemis [ 0 ] not in [ 'lh' , 'rh' ] ) : raise ValueError ( 'Could not determine hemisphere from filename, filename has to start with "lh" or "rh".' ) annot_fname = [ annot_fname ] else : if ( hemi not in [ 'lh' , 'rh' , 'both' ] ) : raise ValueError ( 'hemi has to be "lh", "rh", or "both"' ) if ( hemi == 'both' ) : hemis = [ 'lh' , 'rh' ] else : hemis = [ hemi ] subjects_dir = get_subjects_dir ( subjects_dir , raise_error = True ) dst = op . join ( subjects_dir , subject , 'label' , ( '%%s.%s.annot' % parc ) ) annot_fname = [ ( dst % hemi_ ) for hemi_ in hemis ] return ( annot_fname , hemis )
helper function to get the .