def _find_label_paths(subject='fsaverage', pattern=None, subjects_dir=None):
 subjects_dir = get_subjects_dir(subjects_dir, raise_error=True)
 subject_dir = os.path.join(subjects_dir, subject)
 lbl_dir = os.path.join(subject_dir, 'label')
 if (pattern is None):
  paths = []
  for (dirpath, _, filenames) in os.walk(lbl_dir):
   rel_dir = os.path.relpath(dirpath, lbl_dir)
   for filename in fnmatch.filter(filenames, '*.label'):
    path = os.path.join(rel_dir, filename)
    paths.append(path)
 else:
  paths = [os.path.relpath(path, lbl_dir) for path in iglob(pattern)]
 return paths

def _find_label_paths ( subject = 'fsaverage' , pattern = None , subjects_dir = None ) : subjects_dir = get_subjects_dir ( subjects_dir , raise_error = True ) subject_dir = os . path . join ( subjects_dir , subject ) lbl_dir = os . path . join ( subject_dir , 'label' ) if ( pattern is None ) : paths = [ ] for ( dirpath , _ , filenames ) in os . walk ( lbl_dir ) : rel_dir = os . path . relpath ( dirpath , lbl_dir ) for filename in fnmatch . filter ( filenames , '*.label' ) : path = os . path . join ( rel_dir , filename ) paths . append ( path ) else : paths = [ os . path . relpath ( path , lbl_dir ) for path in iglob ( pattern ) ] return paths
find paths to label files in a subjects label directory .