Skip to content

Instantly share code, notes, and snippets.

@oesteban
Created March 8, 2021 07:18
Show Gist options
  • Save oesteban/3c6e71374f99bcabcbd83ead21b4a43b to your computer and use it in GitHub Desktop.
Save oesteban/3c6e71374f99bcabcbd83ead21b4a43b to your computer and use it in GitHub Desktop.
from pathlib import Path
from nipype.pipeline import engine as pe
from nibabies.workflows.anatomical.registration import init_coregistration_wf
from nibabies.workflows.anatomical.brain_extraction import init_infant_brain_extraction_wf
from nibabies.workflows.anatomical.outputs import init_coreg_report_wf
wf = pe.Workflow(name="nibabies_anat")
be = init_infant_brain_extraction_wf(omp_nthreads=8, age_months=2)
be.inputs.inputnode.in_t2w = "/Users/oesteban/tmp/nibabies-coregistration/data/sub-MOD1319/anat/sub-MOD1319_run-14_T2w.nii.gz"
cr = init_coregistration_wf(omp_nthreads=8)
cr.inputs.inputnode.in_t1w = "/Users/oesteban/tmp/nibabies-coregistration/data/sub-MOD1319/anat/sub-MOD1319_T1w.nii.gz"
rpt = init_coreg_report_wf(output_dir=str(Path.cwd()))
rpt.inputs.inputnode.source_file = "/Users/oesteban/tmp/nibabies-coregistration/data/sub-MOD1319/anat/sub-MOD1319_T1w.nii.gz"
wf.connect([
(be, cr, [("outputnode.t2w_preproc", "inputnode.in_t2w_preproc"),
("outputnode.out_mask", "inputnode.in_mask"),
("outputnode.out_probmap", "inputnode.in_probmap"),
]),
(cr, rpt, [("outputnode.t1w_preproc", "inputnode.t1w_preproc"),
("outputnode.t2w_preproc", "inputnode.t2w_preproc"),
("outputnode.t1w_mask", "inputnode.in_mask"),
]),
])
wf.base_dir = "./workdir"
wf.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment