Skip to content

Commit

Permalink
FIX: Only connect template_iterator_wf if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Nov 8, 2023
1 parent f2395d6 commit b22d008
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions fmriprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ def init_single_subject_wf(subject_id: str):
]) # fmt:skip

# Set up the template iterator once, if used
template_iterator_wf = None

Check warning on line 336 in fmriprep/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/workflows/base.py#L336

Added line #L336 was not covered by tests
if config.workflow.level == "full":
if spaces.cached.get_spaces(nonstandard=False, dim=(3,)):

Check warning on line 338 in fmriprep/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/workflows/base.py#L338

Added line #L338 was not covered by tests
template_iterator_wf = init_template_iterator_wf(spaces=spaces)
Expand Down Expand Up @@ -554,16 +555,17 @@ def init_single_subject_wf(subject_id: str):
]) # fmt:skip

if config.workflow.level == "full":
workflow.connect([
(template_iterator_wf, bold_wf, [
("outputnode.anat2std_xfm", "inputnode.anat2std_xfm"),
("outputnode.space", "inputnode.std_space"),
("outputnode.resolution", "inputnode.std_resolution"),
("outputnode.cohort", "inputnode.std_cohort"),
("outputnode.std_t1w", "inputnode.std_t1w"),
("outputnode.std_mask", "inputnode.std_mask"),
]),
]) # fmt:skip
if template_iterator_wf is not None:
workflow.connect([

Check warning on line 559 in fmriprep/workflows/base.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/workflows/base.py#L558-L559

Added lines #L558 - L559 were not covered by tests
(template_iterator_wf, bold_wf, [
("outputnode.anat2std_xfm", "inputnode.anat2std_xfm"),
("outputnode.space", "inputnode.std_space"),
("outputnode.resolution", "inputnode.std_resolution"),
("outputnode.cohort", "inputnode.std_cohort"),
("outputnode.std_t1w", "inputnode.std_t1w"),
("outputnode.std_mask", "inputnode.std_mask"),
]),
]) # fmt:skip

# Thread MNI152NLin6Asym standard outputs to CIFTI subworkflow, skipping
# the iterator, which targets only output spaces.
Expand Down

0 comments on commit b22d008

Please sign in to comment.