1010
1111def init_fmap_estimation_wf (
1212 epi_targets ,
13+ debug = False ,
1314 generate_report = True ,
1415 name = "fmap_estimation_wf" ,
1516):
@@ -36,13 +37,14 @@ def init_fmap_estimation_wf(
3637
3738 inputnode = pe .Node (niu .IdentityInterface (fields = ["dwi_reference" , "dwi_mask" ]),
3839 name = "inputnode" )
40+ wf .add_nodes ([inputnode ]) # TODO: remove when fully implemented
3941 # 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")
4244
4345 # Return identity transforms for all if fieldmaps are ignored
4446 if "fieldmaps" in config .workflow .ignore :
45- raise NotImplementedError
47+ return wf
4648
4749 # Set-up PEPOLAR estimators only with EPIs under fmap/
4850 # fmap_epi = {f: layout.get_metadata(f)
@@ -51,13 +53,16 @@ def init_fmap_estimation_wf(
5153 # suffix="epi", extension=("nii", "nii.gz"))}
5254
5355 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+
5459 pedirs = [m .get ("PhaseEncodingDirection" , "unknown" ) for m in metadata ]
5560 if len (set (pedirs ) - set (("unknown" ,))) > 1 :
5661 if "unknown" in pedirs or len (set (pe [0 ] for pe in set (pedirs ))) > 1 :
5762 raise NotImplementedError
5863
5964 # Get EPI polarities and their metadata
60- sdc_estimate_wf = init_pepolar_estimate_wf ()
65+ sdc_estimate_wf = init_pepolar_estimate_wf (debug = debug )
6166 sdc_estimate_wf .inputs .inputnode .metadata = metadata
6267
6368 wf .connect ([
@@ -83,7 +88,7 @@ def init_fmap_estimation_wf(
8388 return wf
8489
8590
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" ):
8792 """Initialize a barebones TOPUP implementation."""
8893 from nipype .interfaces .afni import Automask
8994 from nipype .interfaces .fsl .epi import TOPUP
@@ -98,8 +103,8 @@ def init_pepolar_estimate_wf(generate_report=True, name="pepolar_estimate_wf"):
98103
99104 concat_blips = pe .Node (MergeSeries (), name = "concat_blips" )
100105
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" )
103108
104109 pre_mask = pe .Node (Automask (dilate = 1 , outputtype = "NIFTI_GZ" ),
105110 name = "pre_mask" )
0 commit comments