<s> import sct_utils as sct <EOL> import os <EOL> contrast = '<STR_LIT>' <EOL> path = '<STR_LIT>' <EOL> path_output_seg = '<STR_LIT>' <EOL> path_output_im = '<STR_LIT>' <EOL> size = '<STR_LIT>' <EOL> def generate_data_list ( folder_dataset , verbose = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> data_subjects , subjects_dir = [ ] , [ ] <EOL> for subject_dir in os . listdir ( folder_dataset ) : <EOL> if not subject_dir . startswith ( '<STR_LIT:.>' ) and os . path . isdir ( folder_dataset + subject_dir ) : <EOL> data_subjects . append ( folder_dataset + subject_dir + '<STR_LIT:/>' ) <EOL> subjects_dir . append ( subject_dir ) <EOL> if not data_subjects : <EOL> sct . printv ( '<STR_LIT>' + folder_dataset + '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> verbose = verbose , type = '<STR_LIT:error>' ) <EOL> return data_subjects , subjects_dir <EOL> data_subjects , subjects_name = generate_data_list ( path ) <EOL> current_folder = os . getcwd ( ) <EOL> for subject_folder in data_subjects : <EOL> print subject_folder <EOL> os . chdir ( subject_folder + contrast ) <EOL> sct . run ( '<STR_LIT>' + contrast + '<STR_LIT>' <EOL> '<STR_LIT>' + contrast + '<STR_LIT>' <EOL> '<STR_LIT>' + path_output_im + <EOL> '<STR_LIT>' + path_output_seg + <EOL> '<STR_LIT>' + size + '<STR_LIT>' , verbose = <NUM_LIT:2> ) <EOL> os . chdir ( current_folder ) </s>
