Skip to content

Commit 6daf6e4

Browse files
authored
Merge pull request #1654 from FCP-INDI/fix/double-recon-all
🐛 Don't run `recon-all` twice
2 parents 5e3c132 + ee734ca commit 6daf6e4

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

CPAC/anat_preproc/anat_preproc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3188,7 +3188,7 @@ def correct_restore_brain_intensity_abcd(wf, cfg, strat_pool, pipe_num, opt=None
31883188
wf.connect(node, out, merge_t1_acpc_to_list, 'in3')
31893189

31903190
merge_t1_acpc = pe.Node(interface=fslMerge(),
3191-
name='merge_t1_acpc')
3191+
name=f'merge_t1_acpc_{pipe_num}')
31923192

31933193
merge_t1_acpc.inputs.dimension = 't'
31943194

CPAC/surface/tests/test_config.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
Tests for surface configuration
3+
"""
4+
import os
5+
import pkg_resources as p
6+
import pytest
7+
import yaml
8+
9+
from CPAC.pipeline.cpac_pipeline import run_workflow
10+
from CPAC.utils.configuration import Configuration
11+
12+
13+
@pytest.mark.timeout(60)
14+
def test_duplicate_freesurfer():
15+
"""The pipeline should build fast if freesurfer is not self-duplicating"""
16+
c = Configuration(yaml.safe_load('FROM: abcd-options'))
17+
sub_dict = yaml.safe_load(open(p.resource_filename(
18+
"CPAC",
19+
os.path.join(
20+
"resources",
21+
"configs",
22+
"data_config_S3-BIDS-ABIDE.yml"
23+
)
24+
), 'r'))[0]
25+
26+
run_workflow(sub_dict, c, False, test_config=True)

CPAC/utils/configuration.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,15 @@ def __init__(self, config_map=None):
117117
regressor['Name'] = f'Regressor-{str(i + 1)}'
118118
# replace spaces with hyphens in Regressor 'Name's
119119
regressor['Name'] = regressor['Name'].replace(' ', '-')
120+
121+
# Don't double-run FreeSurfer
122+
try:
123+
if 'FreeSurfer-ABCD' in config_map['anatomical_preproc'][
124+
'brain_extraction']['using']:
125+
config_map['surface_analysis']['freesurfer']['run'] = False
126+
except TypeError:
127+
pass
128+
120129
config_map = schema(config_map)
121130

122131
# remove 'FROM' before setting attributes now that it's imported

dev/circleci_data/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ spython >= 0.0.81
44
pytest
55
pytest_bdd
66
pytest_click
7+
pytest-timeout
78
pyyaml
89
yamlordereddictloader

dev/docker_data/default_pipeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ surface_analysis:
170170
# select those 'Freesurfer-' labeled options further below in anatomical_preproc.
171171
freesurfer:
172172

173+
# If anatomical_preproc['brain_extraction']['using'] includes FreeSurfer-ABCD and this switch is On, C-PAC will automatically turn this switch Off to avoid running FreeSurfer twice unnecessarily
173174
run: Off
174175

175176
# Add extra arguments to recon-all command

0 commit comments

Comments
 (0)