10
10
11
11
def init_fmap_estimation_wf (
12
12
epi_targets ,
13
+ debug = False ,
13
14
generate_report = True ,
14
15
name = "fmap_estimation_wf" ,
15
16
):
@@ -36,13 +37,14 @@ def init_fmap_estimation_wf(
36
37
37
38
inputnode = pe .Node (niu .IdentityInterface (fields = ["dwi_reference" , "dwi_mask" ]),
38
39
name = "inputnode" )
40
+ wf .add_nodes ([inputnode ]) # TODO: remove when fully implemented
39
41
# Create one outputnode with a port for each potential EPI target
40
- outputnode = pe .Node (niu .IdentityInterface (fields = [_fname2outname (p ) for p in epi_targets ]),
41
- name = "outputnode" )
42
+ # outputnode = pe.Node(niu.IdentityInterface(fields=[_fname2outname(p) for p in epi_targets]),
43
+ # name="outputnode")
42
44
43
45
# Return identity transforms for all if fieldmaps are ignored
44
46
if "fieldmaps" in config .workflow .ignore :
45
- raise NotImplementedError
47
+ return wf
46
48
47
49
# Set-up PEPOLAR estimators only with EPIs under fmap/
48
50
# fmap_epi = {f: layout.get_metadata(f)
@@ -51,13 +53,16 @@ def init_fmap_estimation_wf(
51
53
# suffix="epi", extension=("nii", "nii.gz"))}
52
54
53
55
metadata = [layout .get_metadata (p ) for p in epi_targets ]
56
+ if any ("TotalReadoutTime" not in m for m in metadata ):
57
+ return wf
58
+
54
59
pedirs = [m .get ("PhaseEncodingDirection" , "unknown" ) for m in metadata ]
55
60
if len (set (pedirs ) - set (("unknown" ,))) > 1 :
56
61
if "unknown" in pedirs or len (set (pe [0 ] for pe in set (pedirs ))) > 1 :
57
62
raise NotImplementedError
58
63
59
64
# Get EPI polarities and their metadata
60
- sdc_estimate_wf = init_pepolar_estimate_wf ()
65
+ sdc_estimate_wf = init_pepolar_estimate_wf (debug = debug )
61
66
sdc_estimate_wf .inputs .inputnode .metadata = metadata
62
67
63
68
wf .connect ([
@@ -83,7 +88,7 @@ def init_fmap_estimation_wf(
83
88
return wf
84
89
85
90
86
- def init_pepolar_estimate_wf (generate_report = True , name = "pepolar_estimate_wf" ):
91
+ def init_pepolar_estimate_wf (debug = False , generate_report = True , name = "pepolar_estimate_wf" ):
87
92
"""Initialize a barebones TOPUP implementation."""
88
93
from nipype .interfaces .afni import Automask
89
94
from nipype .interfaces .fsl .epi import TOPUP
@@ -98,8 +103,8 @@ def init_pepolar_estimate_wf(generate_report=True, name="pepolar_estimate_wf"):
98
103
99
104
concat_blips = pe .Node (MergeSeries (), name = "concat_blips" )
100
105
101
- topup = pe .Node (TOPUP (config = _pkg_fname ("dmriprep" , "data/flirtsch/b02b0.cnf" )),
102
- name = "topup" )
106
+ topup = pe .Node (TOPUP (config = _pkg_fname (
107
+ "dmriprep" , f"data/flirtsch/b02b0 { '_quick' * debug } .cnf" )), name = "topup" )
103
108
104
109
pre_mask = pe .Node (Automask (dilate = 1 , outputtype = "NIFTI_GZ" ),
105
110
name = "pre_mask" )
0 commit comments