Skip to content

Commit 2b3e51c

Browse files
authored
🐛 RBC updates: Switch to MNI2006 templates & CBIG's Schaefer; fix XCP-QC 'final' values (#1737)
2 parents 492ef8a + 4adefa0 commit 2b3e51c

File tree

12 files changed

+235
-150
lines changed

12 files changed

+235
-150
lines changed

.github/workflows/build_stages.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ jobs:
5959
with:
6060
since_last_remote_commit: "true"
6161
files: .github/Dockerfiles/*
62+
- name: Set tag
63+
run: |
64+
TAG=$(sed 's/\./:/' <(echo ${{ matrix.Dockerfile }}))
65+
DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]')
66+
echo DOCKER_TAG=$DOCKER_TAG >> $GITHUB_ENV
67+
docker manifest inspect $DOCKER_TAG >/dev/null
68+
echo "::set-output name=not_yet_exists::$?"
6269
- name: Set up Docker Buildx
6370
uses: docker/[email protected]
6471
if: contains(steps.changed-files-base.outputs.all_changed_files, matrix.Dockerfile) || contains(steps.changed-files.outputs.all_changed_files, matrix.Dockerfile)
@@ -69,11 +76,6 @@ jobs:
6976
username: ${{ github.actor }}
7077
password: ${{ secrets.GITHUB_TOKEN }}
7178
if: contains(steps.changed-files-base.outputs.all_changed_files, matrix.Dockerfile) || contains(steps.changed-files.outputs.all_changed_files, matrix.Dockerfile)
72-
- name: Set tag
73-
run: |
74-
TAG=$(sed 's/\./:/' <(echo ${{ matrix.Dockerfile }}))
75-
echo DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
76-
if: contains(steps.changed-files-base.outputs.all_changed_files, matrix.Dockerfile) || contains(steps.changed-files.outputs.all_changed_files, matrix.Dockerfile)
7779
- name: Build and push Docker image
7880
uses: docker/[email protected]
7981
with:
@@ -149,7 +151,10 @@ jobs:
149151
- name: Set tag
150152
run: |
151153
TAG=$(sed 's/\./:/' <(echo ${{ matrix.Dockerfile }}))
152-
echo DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
154+
DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]')
155+
echo DOCKER_TAG=$DOCKER_TAG >> $GITHUB_ENV
156+
docker manifest inspect $DOCKER_TAG >/dev/null
157+
echo "::set-output name=not_yet_exists::$?"
153158
if: contains(steps.changed-files-base.outputs.all_changed_files, matrix.Dockerfile) || contains(steps.changed-files.outputs.all_changed_files, matrix.Dockerfile)
154159
- name: Prep Dockerfiles for forked repository
155160
if: github.repository_owner != 'FCP-INDI' && contains(steps.changed-files-base.outputs.all_changed_files, matrix.Dockerfile) || contains(steps.changed-files.outputs.all_changed_files, matrix.Dockerfile)
@@ -216,36 +221,39 @@ jobs:
216221
since_last_remote_commit: "true"
217222
files_from_source_file: |
218223
.github/stage_requirements/${{ matrix.variant }}.txt
224+
- name: Set tag
225+
run: |
226+
TAG="stage-base:${{ matrix.variant }}-$(cat version)"
227+
DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]')
228+
echo DOCKER_TAG=$DOCKER_TAG >> $GITHUB_ENV
229+
docker manifest inspect $DOCKER_TAG >/dev/null
230+
echo "::set-output name=not_yet_exists::$?"
231+
id: docker_tag
219232
- name: Clear up some space on runner
220-
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
233+
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
221234
run: |
222235
sudo rm -rf /usr/share/dotnet
223236
sudo rm -rf /opt/ghc
224237
sudo rm -rf "/usr/local/share/boost"
225238
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
226239
- name: Set up Docker Buildx
227240
uses: docker/[email protected]
228-
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
241+
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
229242
- name: Log in to GitHub Container Registry
230243
uses: docker/login-action@v1
231244
with:
232245
registry: ghcr.io
233246
username: ${{ github.actor }}
234247
password: ${{ secrets.GITHUB_TOKEN }}
235-
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
236-
- name: Set tag
237-
run: |
238-
TAG="stage-base:${{ matrix.variant }}-$(cat version)"
239-
echo DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
240-
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
248+
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
241249
- name: Prep Dockerfiles for forked repository
242-
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
250+
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
243251
run: |
244252
.github/scripts/local_ghcr .github/Dockerfiles/base-${{ matrix.variant }}.Dockerfile ${{ github.repository_owner }} $DOCKER_TAG
245253
cat .github/Dockerfiles/base-${{ matrix.variant }}.Dockerfile
246254
- name: See Dockerfile
247255
run: cat .github/Dockerfiles/base-${{ matrix.variant }}.Dockerfile
248-
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
256+
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
249257
- name: Build and push base image
250258
uses: docker/[email protected]
251259
with:
@@ -256,7 +264,7 @@ jobs:
256264
${{ env.DOCKER_TAG }}
257265
cache-from: type=gha
258266
cache-to: type=gha,mode=max
259-
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
267+
if: steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
260268

261269
trigger-next-workflow:
262270
needs: build-base

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4444
- Fixed [bug](https://github.com/FCP-INDI/C-PAC/issues/1702) that was causing `single_step_resampling` to crash with `3dVolReg`
4545
- Fixed [bug](https://github.com/FCP-INDI/C-PAC/issues/1686) that was causing datasets containing phase-difference field maps to crash.
4646
- Fixed merge error preventing QC files and surface derivatives copying to output directory and renaming connectome → connectivity matrix files
47+
- Fixed some incorrect connections in XCP-QC file generation
4748
- Fixed a bug where subsequent subjects' logs were being appended to prior subjects' logs
4849
- Fixed templates used for rodent pipeline and added outputs that were missing
4950
- Fixed [bug](https://github.com/FCP-INDI/C-PAC/issues/1556) in which ITK header imprecision was causing N4 bias correction to crash

CPAC/func_preproc/func_preproc.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,8 @@ def bold_mask_fsl_afni(wf, cfg, strat_pool, pipe_num, opt=None):
15771577
"option_key": ["func_masking", "using"],
15781578
"option_val": "FSL_AFNI",
15791579
"inputs": [["desc-motion_bold", "desc-preproc_bold", "bold"],
1580-
"motion-basefile"],
1580+
"motion-basefile", "FSL-AFNI-bold-ref", "FSL-AFNI-brain-mask",
1581+
"FSL-AFNI-brain-probseg"],
15811582
"outputs": ["space-bold_desc-brain_mask",
15821583
"desc-ref_bold"]}
15831584
'''
@@ -1598,12 +1599,11 @@ def bold_mask_fsl_afni(wf, cfg, strat_pool, pipe_num, opt=None):
15981599
name=f"init_aff_{pipe_num}",
15991600
n_procs=cfg.pipeline_setup['system_config']['num_OMP_threads'],
16001601
)
1602+
node, out = strat_pool.get_data('FSL-AFNI-bold-ref')
1603+
wf.connect(node, out, init_aff, 'fixed_image')
16011604

1602-
init_aff.inputs.fixed_image = cfg.functional_preproc[
1603-
'func_masking']['FSL_AFNI']['bold_ref']
1604-
1605-
init_aff.inputs.fixed_image_mask = cfg.functional_preproc[
1606-
'func_masking']['FSL_AFNI']['brain_mask']
1605+
node, out = strat_pool.get_data('FSL-AFNI-brain-mask')
1606+
wf.connect(node, out, init_aff, 'fixed_image_mask')
16071607

16081608
init_aff.inputs.search_grid = (40, (0, 40, 40))
16091609

@@ -1633,8 +1633,8 @@ def bold_mask_fsl_afni(wf, cfg, strat_pool, pipe_num, opt=None):
16331633
n_procs=cfg.pipeline_setup['system_config']['num_OMP_threads'],
16341634
)
16351635

1636-
norm.inputs.fixed_image = cfg.functional_preproc[
1637-
'func_masking']['FSL_AFNI']['bold_ref']
1636+
node, out = strat_pool.get_data('FSL-AFNI-bold-ref')
1637+
wf.connect(node, out, norm, 'fixed_image')
16381638

16391639
map_brainmask = pe.Node(
16401640
ants.ApplyTransforms(
@@ -1643,10 +1643,10 @@ def bold_mask_fsl_afni(wf, cfg, strat_pool, pipe_num, opt=None):
16431643
),
16441644
name=f"map_brainmask_{pipe_num}",
16451645
)
1646-
1646+
16471647
# Use the higher resolution and probseg for numerical stability in rounding
1648-
map_brainmask.inputs.input_image = cfg.functional_preproc[
1649-
'func_masking']['FSL_AFNI']['brain_probseg']
1648+
node, out = strat_pool.get_data('FSL-AFNI-brain-probseg')
1649+
wf.connect(node, out, map_brainmask, 'input_image')
16501650

16511651
binarize_mask = pe.Node(interface=fsl.maths.MathsCommand(),
16521652
name=f'binarize_mask_{pipe_num}')

CPAC/pipeline/cpac_pipeline.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ def run_workflow(sub_dict, c, run, pipeline_timing_info=None, p_name=None,
273273
set_up_logger(f'{subject_id}_expectedOutputs',
274274
filename=f'{bidsier_prefix(c["subject_id"])}_'
275275
'expectedOutputs.yml',
276-
level='info', log_dir=log_dir, mock=True)
276+
level='info', log_dir=log_dir, mock=True,
277+
overwrite_existing=True)
277278
if c.pipeline_setup['Debugging']['verbose']:
278279
set_up_logger('engine', level='debug', log_dir=log_dir, mock=True)
279280

CPAC/pipeline/schema.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ def _changes_1_8_0_to_1_8_1(config_dict):
866866
# functional_mean_boolean must be True if one of the mutually-
867867
# exclusive options are
868868
# see mutex definition for more definition
869-
'FSL-BET': Any(*(
869+
'FSL-BET': Maybe(Any(*(
870870
# exactly one mutually exclusive option on
871871
[{k: d[k] for d in r for k in d} for r in [[
872872
{
@@ -881,15 +881,15 @@ def _changes_1_8_0_to_1_8_1(config_dict):
881881
**mutex['FSL-BET']['rem'],
882882
'functional_mean_boolean': bool,
883883
**{k: False for k in mutex['FSL-BET']['mutex']}
884-
}])
884+
}]))
885885
),
886886
'FSL_AFNI': {
887887
'bold_ref': Maybe(str),
888888
'brain_mask': Maybe(str),
889889
'brain_probseg': Maybe(str),
890890
},
891891
'Anatomical_Refined': {
892-
'anatomical_mask_dilation': bool,
892+
'anatomical_mask_dilation': Maybe(bool),
893893
},
894894
'apply_func_mask_in_native_space': bool,
895895
},

0 commit comments

Comments
 (0)