''' create_sphere_model_interface = util.Function( input_names=["electrode_location_file", "radii", "out_file"], output_names=[ "mesh_file", "electrode_name_file", "electrode_location_file", "mesh_without_electrodes" ], function=create_4_shell_model) create_sphere_model = pe.Node(interface=create_sphere_model_interface, name="create_sphere_model") create_sphere_model.inputs.radii = radii create_sphere_model.inputs.electrode_location_file = electrode_location_file create_sphere_model.inputs.out_file = "4shell.msh" fwd = create_forward_model_workflow("sphere", conductivity_tensor_included=False) fwd.inputs.inputnode.marker_list = markers fwd.inputs.inputnode.ground_electrode = ground_electrode fwd.inputs.inputnode.conductivity_tensor_included = False fwd.inputs.write_problem_file.orig_pro_file = op.join( os.environ["FWD_DIR"], "etc/eeg_forward_sphere.pro") #fwd.inputs.run_forward_model.binary_output_files = False #for debugging fwd.inputs.run_forward_model.binary_output_files = True fwd.inputs.run_forward_model.out_pos_filenames = [] datasink = pe.Node(interface=nio.DataSink(), name="datasink") datasink.inputs.base_directory = op.abspath('sphere_datasink') sphere_proc = pe.Workflow(name="sphere_proc") sphere_proc.base_dir = os.path.abspath('sphere_proc') sphere_proc.connect([
""" Create the nodes and forward modelling workflow """ create_sphere_model_interface = util.Function( input_names=["electrode_location_file", "radii", "out_file"], output_names=["mesh_file", "electrode_name_file", "electrode_location_file", "mesh_without_electrodes"], function=create_4_shell_model, ) create_sphere_model = pe.Node(interface=create_sphere_model_interface, name="create_sphere_model") create_sphere_model.inputs.radii = radii create_sphere_model.inputs.electrode_location_file = electrode_location_file create_sphere_model.inputs.out_file = "4shell.msh" fwd = create_forward_model_workflow("sphere", conductivity_tensor_included=False) fwd.inputs.inputnode.marker_list = markers fwd.inputs.inputnode.ground_electrode = ground_electrode fwd.inputs.inputnode.conductivity_tensor_included = False fwd.inputs.write_problem_file.orig_pro_file = op.join(os.environ["FWD_DIR"], "etc/eeg_forward_sphere.pro") # fwd.inputs.run_forward_model.binary_output_files = False #for debugging fwd.inputs.run_forward_model.binary_output_files = True fwd.inputs.run_forward_model.out_pos_filenames = [] datasink = pe.Node(interface=nio.DataSink(), name="datasink") datasink.inputs.base_directory = op.abspath("sphere_datasink") sphere_proc = pe.Workflow(name="sphere_proc") sphere_proc.base_dir = os.path.abspath("sphere_proc") sphere_proc.connect( [
info = dict(mesh_file=[['subject_id']], electrode_name_file=[['subject_id']]) datasource = pe.Node(interface=nio.DataGrabber(infields=['subject_id'], outfields=info.keys()), name='datasource') datasource.inputs.sort_filelist = True datasource.inputs.template = "%s" datasource.inputs.base_directory = data_path datasource.inputs.field_template = dict( mesh_file='../%s_gmsh_cond_elec.msh', electrode_name_file='%s/ElectrodeNames.txt' ) #Still using cond on purpose! Other mesh has diff number of elements? datasource.inputs.template_args = info fwd = create_forward_model_workflow("forward_iso", conductivity_tensor_included) fwd.inputs.inputnode.marker_list = markers fwd.inputs.inputnode.ground_electrode = ground_electrode fwd.inputs.inputnode.conductivity_tensor_included = conductivity_tensor_included datasink = pe.Node(interface=nio.DataSink(), name="datasink") datasink.inputs.base_directory = op.abspath('forward_iso_datasink') datasink.inputs.container = 'subject' fwd_proc = pe.Workflow(name="fwd_proc") fwd_proc.base_dir = os.path.abspath('fwd_proc') fwd_proc.connect([(infosource, datasource, [('subject_id', 'subject_id')]), (datasource, fwd, [ ('mesh_file', 'inputnode.mesh_file'), ('electrode_name_file', 'inputnode.electrode_name_file'), ])])
info = dict(mesh_file=[['subject_id']], electrode_name_file=[['subject_id']]) datasource = pe.Node(interface=nio.DataGrabber(infields=['subject_id'], outfields=info.keys()), name='datasource') datasource.inputs.sort_filelist = True datasource.inputs.template = "%s" datasource.inputs.base_directory = data_path datasource.inputs.field_template = dict( mesh_file='../%s_gmsh_cond_elec.msh', electrode_name_file='%s/ElectrodeNames.txt') datasource.inputs.template_args = info fwd = create_forward_model_workflow("forward", conductivity_tensor_included) fwd.inputs.inputnode.marker_list = markers fwd.inputs.inputnode.ground_electrode = ground_electrode fwd.inputs.inputnode.conductivity_tensor_included = conductivity_tensor_included datasink = pe.Node(interface=nio.DataSink(), name="datasink") datasink.inputs.base_directory = op.abspath('forward_datasink') datasink.inputs.container = 'subject' fwd_proc = pe.Workflow(name="fwd_proc") fwd_proc.base_dir = os.path.abspath('fwd_proc') fwd_proc.connect([ (infosource,datasource,[('subject_id', 'subject_id')]), (datasource,fwd,[('mesh_file','inputnode.mesh_file'), ('electrode_name_file','inputnode.electrode_name_file'),