@@ -1611,7 +1611,7 @@ def bold_mask_anatomical_resampled(wf, cfg, strat_pool, pipe_num, opt=None):
16111611
16121612 Adapted from `DCAN Lab's BOLD mask method from the ABCD pipeline <https://github.com/DCAN-Labs/DCAN-HCP/blob/1d90814/fMRIVolume/scripts/OneStepResampling.sh#L121-L132>`_.
16131613 """
1614- anat_brain_to_func_res = anat_brain_to_bold_res (wf , cfg , pipe_num )
1614+ anat_brain_to_func_res = anat_brain_to_bold_res (wf_name = "anat_brain_to_bold_res" , cfg , pipe_num )
16151615
16161616 node , out = strat_pool .get_data ("space-template_desc-preproc_T1w" )
16171617 wf .connect (
@@ -1836,6 +1836,52 @@ def bold_masking(wf, cfg, strat_pool, pipe_num, opt=None):
18361836
18371837 return (wf , outputs )
18381838
1839+ @nodeblock (
1840+ name = "template_space_bold_masking" ,
1841+ switch = [
1842+ ["functional_preproc" , "run" ],
1843+ ["functional_preproc" , "template_space_func_masking" , "run" ],
1844+ ["functional_preproc" , "template_space_func_masking" , "apply_func_mask_in_template_space" ],
1845+ ],
1846+ inputs = [("space-template_desc-preproc_bold" , "space-template_desc-bold_mask" )],
1847+ outputs = {
1848+ "space-template_desc-preproc_bold" : {
1849+ "Description" : "The skull-stripped BOLD time-series." ,
1850+ "SkullStripped" : True ,
1851+ },
1852+ "space-template_desc-brain_bold" : {
1853+ "Description" : "The skull-stripped BOLD time-series." ,
1854+ "SkullStripped" : True ,
1855+ },
1856+ "space-template_desc-head_bold" : {
1857+ "Description" : "The non skull-stripped BOLD time-series." ,
1858+ "SkullStripped" : False ,
1859+ },
1860+ },
1861+ )
1862+ def template_space_bold_masking (wf , cfg , strat_pool , pipe_num , opt = None ):
1863+ """Mask the bold in template space."""
1864+ func_edge_detect = pe .Node (
1865+ interface = afni_utils .Calc (), name = f"template_space_func_extract_brain_{ pipe_num } "
1866+ )
1867+
1868+ func_edge_detect .inputs .expr = "a*b"
1869+ func_edge_detect .inputs .outputtype = "NIFTI_GZ"
1870+
1871+ node_head_bold , out_head_bold = strat_pool .get_data ("space-template_desc-preproc_bold" )
1872+ wf .connect (node_head_bold , out_head_bold , func_edge_detect , "in_file_a" )
1873+
1874+ node , out = strat_pool .get_data ("space-template_desc-bold_mask" )
1875+ wf .connect (node , out , func_edge_detect , "in_file_b" )
1876+
1877+ outputs = {
1878+ "space-template_desc-preproc_bold" : (func_edge_detect , "out_file" ),
1879+ "space-template_desc-brain_bold" : (func_edge_detect , "out_file" ),
1880+ "space-template_desc-head_bold" : (node_head_bold , out_head_bold ),
1881+ }
1882+
1883+ return (wf , outputs )
1884+
18391885
18401886@nodeblock (
18411887 name = "func_mean" ,
0 commit comments