def _prep_label_split(label, subject=None, subjects_dir=None):
 if isinstance(label, BiHemiLabel):
  raise TypeError('Can only split labels restricted to one hemisphere.')
 elif isinstance(label, string_types):
  label = read_label(label)
 subjects_dir = get_subjects_dir(subjects_dir, raise_error=True)
 if ((label.subject is None) and (subject is None)):
  raise ValueError('The subject needs to be specified.')
 elif (subject is None):
  subject = label.subject
 elif (label.subject is None):
  pass
 elif (subject != label.subject):
  raise ValueError(('The label specifies a different subject (%r) from the subject parameter (%r).' % label.subject), subject)
 return (label, subject, subjects_dir)

def _prep_label_split ( label , subject = None , subjects_dir = None ) : if isinstance ( label , BiHemiLabel ) : raise TypeError ( 'Can only split labels restricted to one hemisphere.' ) elif isinstance ( label , string_types ) : label = read_label ( label ) subjects_dir = get_subjects_dir ( subjects_dir , raise_error = True ) if ( ( label . subject is None ) and ( subject is None ) ) : raise ValueError ( 'The subject needs to be specified.' ) elif ( subject is None ) : subject = label . subject elif ( label . subject is None ) : pass elif ( subject != label . subject ) : raise ValueError ( ( 'The label specifies a different subject (%r) from the subject parameter (%r).' % label . subject ) , subject ) return ( label , subject , subjects_dir )
get label and subject information prior to label spliting .