def create_workflow_preproc(): """Create nodes and connect them into a workflow""" main_workflow = pe.Workflow(name=preproc_pipeline_name) main_workflow.base_dir = main_path # Info source infosource = create_infosource() # Data source datasource = create_datasource() main_workflow.connect(infosource, 'subject_id', datasource, 'subject_id') main_workflow.connect(infosource, 'sess_index', datasource, 'sess_index') preproc_workflow = create_pipeline_preproc_meeg(main_path, l_freq=l_freq, h_freq=h_freq, down_sfreq=down_sfreq, variance=variance, ECG_ch_name=ECG_ch_name, EoG_ch_name=EoG_ch_name, data_type=data_type) main_workflow.connect(infosource, 'subject_id', preproc_workflow, 'inputnode.subject_id') main_workflow.connect(datasource, 'raw_file', preproc_workflow, 'inputnode.raw_file') return main_workflow
infosource = pe.Node(interface=IdentityInterface(fields=["subject_id", "sess_index"]), name="infosource") infosource.iterables = [("subject_id", subject_ids), ("sess_index", sessions)] # data source datasource = pe.Node( interface=nio.DataGrabber(infields=["subject_id", "sess_index"], outfields=["raw_file"]), name="datasource" ) datasource.inputs.base_directory = data_path datasource.inputs.template = "%s/%s%s" datasource.inputs.template_args = dict(raw_file=[["subject_id", "sess_index", ".ds"]]) datasource.inputs.sort_filelist = True main_workflow.connect(infosource, "subject_id", datasource, "subject_id") main_workflow.connect(infosource, "sess_index", datasource, "sess_index") preproc_workflow = create_pipeline_preproc_meeg(main_path, is_sensor_space=False, data_type="ds") main_workflow.connect(datasource, "raw_file", preproc_workflow, "inputnode.raw_file") inv_sol_workflow = create_pipeline_source_reconstruction(main_path, sbj_dir) main_workflow.connect(infosource, "subject_id", inv_sol_workflow, "inputnode.sbj_id") # # main_workflow.connect(preproc_workflow, ('preproc.out_file', get_raw_info), # LF_workflow, 'inputnode.raw_info') # main_workflow.connect(preproc_workflow, "preproc.out_file", inv_sol_workflow, "inputnode.raw") # run pipeline main_workflow.write_graph(graph2use="colored") # colored main_workflow.config["execution"] = {"remove_unnecessary_outputs": "false"}
datasource.inputs.sort_filelist = True main_workflow.connect(infosource, 'subject_id', datasource, 'subject_id') main_workflow.connect(infosource, 'sess_index', datasource, 'sess_index') if not is_preproc: is_set_ICA_components = False if is_set_ICA_components: n_comp_exclude = {'S01': [[0, 5, 53]]} else: n_comp_exclude = [] preproc_workflow = create_pipeline_preproc_meeg(main_path, is_sensor_space=False, is_set_ICA_components=is_set_ICA_components, n_comp_exclude=n_comp_exclude, data_type='ds') main_workflow.connect(datasource, 'raw_file', preproc_workflow, 'inputnode.raw_file') if aseg: aseg_labels = aseg_labels else: aseg_labels = [] inv_sol_workflow = create_pipeline_source_reconstruction(main_path, sbj_dir, spacing='ico-5', inv_method=inv_method,