def create_bem_flow(name='bem', out_format='stl'):
 '\n    Initialize the workflow\n    '
 bemflow = pe.Workflow(name=name)
 '\n    Define the inputs to the workflow.\n    '
 inputnode = pe.Node(niu.IdentityInterface(fields=['subject_id', 'subjects_dir']), name='inputspec')
 '\n    Define all the nodes of the workflow:\n\n      fssource: used to retrieve aseg.mgz\n      mri_convert : converts aseg.mgz to aseg.nii\n      tessellate : tessellates regions in aseg.mgz\n      surfconvert : converts regions to stereolithographic (.stl) format\n\n    '
 watershed_bem = pe.Node(interface=mne.WatershedBEM(), name='WatershedBEM')
 surfconvert = pe.MapNode(fs.MRIsConvert(out_datatype=out_format), iterfield=['in_file'], name='surfconvert')
 '\n    Connect the nodes\n    '
 bemflow.connect([(inputnode, watershed_bem, [('subject_id', 'subject_id'), ('subjects_dir', 'subjects_dir')]), (watershed_bem, surfconvert, [('mesh_files', 'in_file')])])
 '\n    Setup an outputnode that defines relevant inputs of the workflow.\n    '
 outputnode = pe.Node(niu.IdentityInterface(fields=['meshes']), name='outputspec')
 bemflow.connect([(surfconvert, outputnode, [('converted', 'meshes')])])
 return bemflow

def create_bem_flow ( name = 'bem' , out_format = 'stl' ) : bemflow = pe . Workflow ( name = name ) inputnode = pe . Node ( niu . IdentityInterface ( fields = [ 'subject_id' , 'subjects_dir' ] ) , name = 'inputspec' ) watershed_bem = pe . Node ( interface = mne . WatershedBEM ( ) , name = 'WatershedBEM' ) surfconvert = pe . MapNode ( fs . MRIsConvert ( out_datatype = out_format ) , iterfield = [ 'in_file' ] , name = 'surfconvert' ) bemflow . connect ( [ ( inputnode , watershed_bem , [ ( 'subject_id' , 'subject_id' ) , ( 'subjects_dir' , 'subjects_dir' ) ] ) , ( watershed_bem , surfconvert , [ ( 'mesh_files' , 'in_file' ) ] ) ] ) outputnode = pe . Node ( niu . IdentityInterface ( fields = [ 'meshes' ] ) , name = 'outputspec' ) bemflow . connect ( [ ( surfconvert , outputnode , [ ( 'converted' , 'meshes' ) ] ) ] ) return bemflow
uses mnes watershed algorithm to create boundary element meshes for a subjects brain .