Skip to content

Commit b378709

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 9cca410 commit b378709

File tree

6 files changed

+30
-17
lines changed

6 files changed

+30
-17
lines changed

CPAC/func_preproc/func_motion.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,18 @@ def calc_motion_stats(wf, cfg, strat_pool, pipe_num, opt=None):
8888
"inputspec.motion_correct",
8989
)
9090

91-
try :
92-
wf.connect(*strat_pool.get_data("space-bold_desc-brain_mask"),
91+
try:
92+
wf.connect(
93+
*strat_pool.get_data("space-bold_desc-brain_mask"),
9394
gen_motion_stats,
9495
"inputspec.mask",
9596
)
96-
except :
97+
except:
9798
mask_bold = pe.Node(interface=afni.MaskTool(), name=f"mask_bold_{pipe_num}")
9899
mask_bold.inputs.outputtype = "NIFTI_GZ"
99100
node, out = strat_pool.get_data("desc-preproc_bold")
100101
wf.connect(node, out, mask_bold, "in_file")
101-
wf.connect(mask_bold, "out_file", gen_motion_stats, "inputspec.mask")
102+
wf.connect(mask_bold, "out_file", gen_motion_stats, "inputspec.mask")
102103

103104
wf.connect(
104105
*strat_pool.get_data("desc-movementParameters_motion"),

CPAC/func_preproc/func_preproc.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,9 @@ 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_name="anat_brain_to_bold_res", cfg=cfg, pipe_num=pipe_num)
1614+
anat_brain_to_func_res = anat_brain_to_bold_res(
1615+
wf_name="anat_brain_to_bold_res", cfg=cfg, pipe_num=pipe_num
1616+
)
16151617

16161618
node, out = strat_pool.get_data("space-template_desc-preproc_T1w")
16171619
wf.connect(
@@ -1836,12 +1838,17 @@ def bold_masking(wf, cfg, strat_pool, pipe_num, opt=None):
18361838

18371839
return (wf, outputs)
18381840

1841+
18391842
@nodeblock(
18401843
name="template_space_bold_masking",
18411844
switch=[
18421845
["functional_preproc", "run"],
18431846
["functional_preproc", "template_space_func_masking", "run"],
1844-
["functional_preproc", "template_space_func_masking", "apply_func_mask_in_template_space"],
1847+
[
1848+
"functional_preproc",
1849+
"template_space_func_masking",
1850+
"apply_func_mask_in_template_space",
1851+
],
18451852
],
18461853
inputs=[("space-template_desc-preproc_bold", "space-template_desc-bold_mask")],
18471854
outputs={
@@ -1862,13 +1869,16 @@ def bold_masking(wf, cfg, strat_pool, pipe_num, opt=None):
18621869
def template_space_bold_masking(wf, cfg, strat_pool, pipe_num, opt=None):
18631870
"""Mask the bold in template space."""
18641871
func_edge_detect = pe.Node(
1865-
interface=afni_utils.Calc(), name=f"template_space_func_extract_brain_{pipe_num}"
1872+
interface=afni_utils.Calc(),
1873+
name=f"template_space_func_extract_brain_{pipe_num}",
18661874
)
18671875

18681876
func_edge_detect.inputs.expr = "a*b"
18691877
func_edge_detect.inputs.outputtype = "NIFTI_GZ"
18701878

1871-
node_head_bold, out_head_bold = strat_pool.get_data("space-template_desc-preproc_bold")
1879+
node_head_bold, out_head_bold = strat_pool.get_data(
1880+
"space-template_desc-preproc_bold"
1881+
)
18721882
wf.connect(node_head_bold, out_head_bold, func_edge_detect, "in_file_a")
18731883

18741884
node, out = strat_pool.get_data("space-template_desc-bold_mask")

CPAC/pipeline/cpac_pipeline.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,13 +1512,15 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None):
15121512
warp_bold_mask_to_EPItemplate,
15131513
warp_deriv_mask_to_EPItemplate,
15141514
]
1515-
1515+
15161516
# Template space functional masking
15171517
if cfg.functional_preproc["template_space_func_masking"]["run"]:
15181518
if not rpool.check_rpool("space-template_desc-bold_mask"):
1519-
pipeline_blocks += bold_mask_anatomical_resampled,
1520-
if cfg.functional_preproc["template_space_func_masking"]["apply_func_mask_in_template_space"]:
1521-
pipeline_blocks += template_space_bold_masking,
1519+
pipeline_blocks += (bold_mask_anatomical_resampled,)
1520+
if cfg.functional_preproc["template_space_func_masking"][
1521+
"apply_func_mask_in_template_space"
1522+
]:
1523+
pipeline_blocks += (template_space_bold_masking,)
15221524

15231525
# Template-space nuisance regression
15241526
nuisance_template = (

CPAC/resources/configs/pipeline_config_abcd-options.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ registration_workflows:
218218

219219
# Choose coregistration degree of freedom
220220
dof: 12
221-
221+
222222

223223

224224
func_registration_to_template:
@@ -331,7 +331,7 @@ nuisance_corrections:
331331

332332
# switch to Off if nuisance regression is off and you don't want to write out the regressors
333333
create_regressors: Off
334-
334+
335335
# Process and refine masks used to produce regressors and time series for
336336
# regression.
337337
regressor_masks:

CPAC/resources/configs/pipeline_config_abcd-prep.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,4 @@ functional_preproc:
233233
# Anatomical_Resampled: Resample anatomical brain mask in standard space to get BOLD brain mask in standard space. Adapted from DCAN Lab's BOLD mask method from the ABCD pipeline. ("Create fMRI resolution standard space files for T1w image, wmparc, and brain mask […] don't use FLIRT to do spline interpolation with -applyisoxfm for the 2mm and 1mm cases because it doesn't know the peculiarities of the MNI template FOVs")
234234
using: [Anatomical_Resampled]
235235

236-
apply_func_mask_in_template_space: On
236+
apply_func_mask_in_template_space: On

CPAC/resources/configs/pipeline_config_blank.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,14 +1150,14 @@ functional_preproc:
11501150

11511151
# Choose whether or not to dilate the anatomical mask if you choose 'Anatomical_Refined' as the functional masking option. It will dilate one voxel if enabled.
11521152
anatomical_mask_dilation: Off
1153-
1153+
11541154
template_space_func_masking:
11551155
run: Off
11561156
# Anatomical_Resampled: Resample anatomical brain mask in standard space to get BOLD brain mask in standard space. Adapted from DCAN Lab's BOLD mask method from the ABCD pipeline. ("Create fMRI resolution standard space files for T1w image, wmparc, and brain mask […] don't use FLIRT to do spline interpolation with -applyisoxfm for the 2mm and 1mm cases because it doesn't know the peculiarities of the MNI template FOVs")
11571157
using: [Anatomical_Resampled]
11581158

11591159
apply_func_mask_in_template_space: Off
1160-
1160+
11611161
generate_func_mean:
11621162

11631163
# Generate mean functional image

0 commit comments

Comments
 (0)