-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
80 lines (71 loc) · 2.62 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import nipype.pipeline.engine as pe
from nipype.interfaces import IdentityInterface
from nipype import SelectFiles, Node
from full import create_study_pipeline
from configuration import (
PRIMAVOICE,
CENTER,
MODALITY,
ACQUISITION,
CORRECTION,
SUBJECTS,
)
def create_main_pipeline(subject_list=SUBJECTS):
RADIUS = 5 # selection sphere radius (mm)
# create node that contains meta-variables about data
inputnode = Node(
IdentityInterface(
fields=["subject_id", "center", "modality", "acquisition", "correction"]
),
name="inputnode",
)
inputnode.inputs.center = CENTER
inputnode.inputs.modality = MODALITY
inputnode.inputs.acquisition = ACQUISITION
inputnode.inputs.correction = CORRECTION
inputnode.iterables = [("subject_id", subject_list)]
#
templates = {
"diffusion_volume": "DTI/{center}/{subject_id}/{modality}/{acquisition}/{"
"correction}/corrected_dwi_{subject_id}.nii.gz",
"bvals": "DTI/{center}/{subject_id}/{modality}/{acquisition}/raw_bvals_{subject_id}.txt",
"bvecs": "DTI/{center}/{subject_id}/{modality}/{acquisition}/{correction}/corrected_bvecs_{subject_id}.txt",
"t1_volume": "analysis_{subject_id}/anat/{"
"subject_id}_ses-01_T1w_denoised_debiased_in-MNI152.nii.gz",
"func_contrast_volume": "analysis_{subject_id}/spm_realign/results_8WM_9CSF_0mvt/In-MNI152_{subject_id}_res-8WM_9CSF_0mvt_human_vs_all_t.nii.gz",
}
datagrabber = pe.Node(SelectFiles(templates), name="datagrabber")
datagrabber.inputs.base_directory = PRIMAVOICE
study_pipeline = create_study_pipeline(radius=RADIUS)
main_pipeline = pe.Workflow(name="main_pipeline")
main_pipeline.connect(
[
(
inputnode,
datagrabber,
[
("subject_id", "subject_id"),
("center", "center"),
("modality", "modality"),
("acquisition", "acquisition"),
("correction", "correction"),
],
)
]
)
main_pipeline.connect(
[
(
datagrabber,
study_pipeline,
[
("diffusion_volume", "inputnode.diffusion_volume"),
("bvals", "inputnode.bvals"),
("bvecs", "inputnode.bvecs"),
("t1_volume", "inputnode.t1_volume"),
("func_contrast_volume", "inputnode.func_contrast_volume"),
],
)
]
)
return main_pipeline