name='datasource') datasource.inputs.sort_filelist = True datasource.inputs.template = "%s" datasource.inputs.base_directory = data_path if conductivity_tensor_included: datasource.inputs.field_template = dict( mesh_file='%s_gmsh_cond_elec.msh', electrode_name_file='%s.txt', dipole_file="%s*-lh.dip", leadfield="%s_aniso_leadfield.hdf5") else: datasource.inputs.field_template = dict( mesh_file='%s_gmsh_cond_elec.msh', electrode_name_file='%s.txt', dipole_file="%s*-lh.dip", leadfield="%s_iso_leadfield.hdf5") datasource.inputs.template_args = info cost = create_cost_function_workflow("dipole_cost") cost.inputs.inputnode.dipole_row = dipole_row cost.inputs.inputnode.mesh_id = 1002 datasink = pe.Node(interface=nio.DataSink(), name="datasink") datasink.inputs.base_directory = op.abspath('forward_datasink') datasink.inputs.container = 'subject' cost_proc = pe.Workflow(name="cost_proc") cost_proc.base_dir = os.path.abspath('cost_proc') cost_proc.connect([ (infosource, datasource,[('subject_id', 'subject_id')]), (datasource, cost,[('mesh_file','inputnode.mesh_file'), ('dipole_file','inputnode.dipole_file'), ('leadfield','inputnode.leadfield'),
electrode_location_file = op.join(os.environ["FWD_DIR"], "etc", "icosahedron42.txt") dipole_location_file = op.join(os.environ["FWD_DIR"], "etc", "sphere_dipole.dip") leadfield_file = op.join(os.environ["FWD_DIR"], "examples", "sphere_datasink", "leadfield", "leadfield.hdf5") mesh_file = op.join(os.environ["FWD_DIR"], "examples", "sphere_datasink", "mesh_file", "4shell_elec.msh") electrode_name_file = op.join( os.environ["FWD_DIR"], "examples", "sphere_datasink", "electrode_name_file", "icosahedron42.txt_names.txt" ) dipole_row = 0 """ Create the nodes and forward modelling workflow """ cost = create_cost_function_workflow("sphere") cost.inputs.inputnode.dipole_file = dipole_location_file cost.inputs.inputnode.leadfield = leadfield_file cost.inputs.inputnode.dipole_row = dipole_row cost.inputs.inputnode.mesh_id = 1001 cost.inputs.inputnode.mesh_file = mesh_file datasink = pe.Node(interface=nio.DataSink(), name="datasink") datasink.inputs.base_directory = op.abspath("sphere_cost_datasink") sphere_proc = pe.Workflow(name="sphere_cost_proc") sphere_proc.base_dir = os.path.abspath("sphere_cost_proc") sphere_proc.connect([(cost, datasink, [("outputnode.mesh_file", "cost_mesh_file")])]) sphere_proc.connect([(cost, datasink, [("outputnode.potential_from_dipole", "potential_from_dipole")])]) if __name__ == "__main__":
ground_electrode = 'vertex001' radii=[85, 88, 92, 100] electrode_location_file = op.join(os.environ["FWD_DIR"], "etc", "icosahedron42.txt") dipole_location_file = op.join(os.environ["FWD_DIR"], "etc", "sphere_dipole.dip") leadfield_file = op.join(os.environ["FWD_DIR"], "examples", "sphere_datasink", "leadfield", "leadfield.hdf5") mesh_file = op.join(os.environ["FWD_DIR"], "examples", "sphere_datasink", "mesh_file", "4shell_elec.msh") electrode_name_file = op.join(os.environ["FWD_DIR"], "examples", "sphere_datasink", "electrode_name_file", "icosahedron42.txt_names.txt") dipole_row = 0 ''' Create the nodes and forward modelling workflow ''' cost = create_cost_function_workflow("sphere") cost.inputs.inputnode.dipole_file = dipole_location_file cost.inputs.inputnode.leadfield = leadfield_file cost.inputs.inputnode.dipole_row = dipole_row cost.inputs.inputnode.mesh_id = 1001 cost.inputs.inputnode.mesh_file = mesh_file datasink = pe.Node(interface=nio.DataSink(), name="datasink") datasink.inputs.base_directory = op.abspath('sphere_cost_datasink') sphere_proc = pe.Workflow(name="sphere_cost_proc") sphere_proc.base_dir = os.path.abspath('sphere_cost_proc') sphere_proc.connect([(cost, datasink, [("outputnode.mesh_file", "cost_mesh_file")])]) sphere_proc.connect([(cost, datasink, [("outputnode.potential_from_dipole", "potential_from_dipole")])])