Skip to content

Commit 8c51992

Browse files
authored
enh: add boldref / sbref to source metadata (#3532)
Closes #3498
2 parents 089b494 + 10c20b9 commit 8c51992

11 files changed

+135
-86
lines changed

.circleci/ds005_partial_fasttrack_outputs.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ sub-01/anat/sub-01_space-MNI152NLin6Asym_label-CSF_desc-preproc_probseg.nii.gz
6161
sub-01/anat/sub-01_space-MNI152NLin6Asym_label-GM_desc-preproc_probseg.nii.gz
6262
sub-01/anat/sub-01_space-MNI152NLin6Asym_label-WM_desc-preproc_probseg.nii.gz
6363
sub-01/fmap
64+
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-brain_mask.nii.gz
6465
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-coeff_fieldmap.nii.gz
6566
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz
6667
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-preproc_fieldmap.json
@@ -76,8 +77,8 @@ sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-hmc_boldref.json
7677
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-hmc_boldref.nii.gz
7778
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json
7879
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt
79-
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-auto00000_mode-image_xfm.json
80-
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-auto00000_mode-image_xfm.txt
80+
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.json
81+
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.txt
8182
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-orig_to-boldref_mode-image_desc-hmc_xfm.json
8283
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-orig_to-boldref_mode-image_desc-hmc_xfm.txt
8384
sub-01/func/sub-01_task-mixedgamblestask_run-02_hemi-L_space-fsaverage5_bold.func.gii

.circleci/ds005_partial_outputs.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ sub-01/anat/sub-01_space-MNI152NLin6Asym_label-CSF_probseg.nii.gz
8383
sub-01/anat/sub-01_space-MNI152NLin6Asym_label-GM_probseg.nii.gz
8484
sub-01/anat/sub-01_space-MNI152NLin6Asym_label-WM_probseg.nii.gz
8585
sub-01/fmap
86+
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-brain_mask.nii.gz
8687
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-coeff_fieldmap.nii.gz
8788
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz
8889
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-preproc_fieldmap.json
@@ -96,8 +97,8 @@ sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-coreg_boldref.json
9697
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-coreg_boldref.nii.gz
9798
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-hmc_boldref.json
9899
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-hmc_boldref.nii.gz
99-
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-auto00000_mode-image_xfm.json
100-
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-auto00000_mode-image_xfm.txt
100+
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.json
101+
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.txt
101102
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json
102103
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt
103104
sub-01/func/sub-01_task-mixedgamblestask_run-02_from-orig_to-boldref_mode-image_desc-hmc_xfm.json

.circleci/ds054_fasttrack_outputs.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-CSF_desc-prepro
1818
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-GM_desc-preproc_probseg.nii.gz
1919
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-WM_desc-preproc_probseg.nii.gz
2020
sub-100185/fmap
21+
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-brain_mask.nii.gz
2122
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-coeff_fieldmap.nii.gz
2223
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz
2324
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-preproc_fieldmap.json
@@ -33,8 +34,8 @@ sub-100185/func/sub-100185_task-machinegame_run-01_desc-hmc_boldref.json
3334
sub-100185/func/sub-100185_task-machinegame_run-01_desc-hmc_boldref.nii.gz
3435
sub-100185/func/sub-100185_task-machinegame_run-01_desc-preproc_bold.json
3536
sub-100185/func/sub-100185_task-machinegame_run-01_desc-preproc_bold.nii.gz
36-
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-auto00000_mode-image_xfm.json
37-
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-auto00000_mode-image_xfm.txt
37+
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.json
38+
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.txt
3839
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json
3940
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt
4041
sub-100185/func/sub-100185_task-machinegame_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.json
@@ -61,8 +62,8 @@ sub-100185/func/sub-100185_task-machinegame_run-02_desc-hmc_boldref.json
6162
sub-100185/func/sub-100185_task-machinegame_run-02_desc-hmc_boldref.nii.gz
6263
sub-100185/func/sub-100185_task-machinegame_run-02_desc-preproc_bold.json
6364
sub-100185/func/sub-100185_task-machinegame_run-02_desc-preproc_bold.nii.gz
64-
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-auto00000_mode-image_xfm.json
65-
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-auto00000_mode-image_xfm.txt
65+
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.json
66+
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.txt
6667
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json
6768
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt
6869
sub-100185/func/sub-100185_task-machinegame_run-02_from-orig_to-boldref_mode-image_desc-hmc_xfm.json

.circleci/ds054_outputs.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-CSF_probseg.nii
2828
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-GM_probseg.nii.gz
2929
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-WM_probseg.nii.gz
3030
sub-100185/fmap
31+
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-brain_mask.nii.gz
3132
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-coeff_fieldmap.nii.gz
3233
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz
3334
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-preproc_fieldmap.json
@@ -43,8 +44,8 @@ sub-100185/func/sub-100185_task-machinegame_run-01_desc-hmc_boldref.json
4344
sub-100185/func/sub-100185_task-machinegame_run-01_desc-hmc_boldref.nii.gz
4445
sub-100185/func/sub-100185_task-machinegame_run-01_desc-preproc_bold.json
4546
sub-100185/func/sub-100185_task-machinegame_run-01_desc-preproc_bold.nii.gz
46-
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-auto00000_mode-image_xfm.json
47-
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-auto00000_mode-image_xfm.txt
47+
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.json
48+
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.txt
4849
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json
4950
sub-100185/func/sub-100185_task-machinegame_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt
5051
sub-100185/func/sub-100185_task-machinegame_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.json
@@ -71,8 +72,8 @@ sub-100185/func/sub-100185_task-machinegame_run-02_desc-hmc_boldref.json
7172
sub-100185/func/sub-100185_task-machinegame_run-02_desc-hmc_boldref.nii.gz
7273
sub-100185/func/sub-100185_task-machinegame_run-02_desc-preproc_bold.json
7374
sub-100185/func/sub-100185_task-machinegame_run-02_desc-preproc_bold.nii.gz
74-
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-auto00000_mode-image_xfm.json
75-
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-auto00000_mode-image_xfm.txt
75+
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.json
76+
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.txt
7677
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json
7778
sub-100185/func/sub-100185_task-machinegame_run-02_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt
7879
sub-100185/func/sub-100185_task-machinegame_run-02_from-orig_to-boldref_mode-image_desc-hmc_xfm.json

.circleci/ds210_fasttrack_outputs.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-CSF_desc-preproc_probseg.nii.
1717
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-GM_desc-preproc_probseg.nii.gz
1818
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-WM_desc-preproc_probseg.nii.gz
1919
sub-02/fmap
20+
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-brain_mask.nii.gz
2021
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-coeff_fieldmap.nii.gz
2122
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz
2223
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-preproc_fieldmap.json
@@ -36,8 +37,8 @@ sub-02/func/sub-02_task-cuedSGT_run-01_echo-2_desc-preproc_bold.json
3637
sub-02/func/sub-02_task-cuedSGT_run-01_echo-2_desc-preproc_bold.nii.gz
3738
sub-02/func/sub-02_task-cuedSGT_run-01_echo-3_desc-preproc_bold.json
3839
sub-02/func/sub-02_task-cuedSGT_run-01_echo-3_desc-preproc_bold.nii.gz
39-
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_xfm.json
40-
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_xfm.txt
40+
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.json
41+
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.txt
4142
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json
4243
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt
4344
sub-02/func/sub-02_task-cuedSGT_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.json

.circleci/ds210_outputs.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz
2727
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz
2828
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz
2929
sub-02/fmap
30+
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-brain_mask.nii.gz
3031
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-coeff_fieldmap.nii.gz
3132
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz
3233
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-preproc_fieldmap.json
@@ -46,8 +47,8 @@ sub-02/func/sub-02_task-cuedSGT_run-01_echo-2_desc-preproc_bold.json
4647
sub-02/func/sub-02_task-cuedSGT_run-01_echo-2_desc-preproc_bold.nii.gz
4748
sub-02/func/sub-02_task-cuedSGT_run-01_echo-3_desc-preproc_bold.json
4849
sub-02/func/sub-02_task-cuedSGT_run-01_echo-3_desc-preproc_bold.nii.gz
49-
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_xfm.json
50-
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_xfm.txt
50+
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.json
51+
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-auto00000_mode-image_desc-fmap_xfm.txt
5152
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json
5253
sub-02/func/sub-02_task-cuedSGT_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt
5354
sub-02/func/sub-02_task-cuedSGT_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.json

fmriprep/workflows/bold/base.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ def init_bold_wf(
314314

315315
if boldref_out or echos_out:
316316
ds_bold_native_wf = init_ds_bold_native_wf(
317+
source_file=bold_series,
317318
bids_root=str(config.execution.bids_dir),
318319
output_dir=fmriprep_dir,
319320
bold_output=boldref_out,
@@ -372,9 +373,14 @@ def init_bold_wf(
372373
for node in workflow.list_node_names():
373374
if node.split('.')[-1].startswith('ds_report'):
374375
workflow.get_node(node).inputs.base_directory = fmriprep_dir
375-
workflow.get_node(node).inputs.source_file = bold_file
376376
return workflow
377377

378+
# Pass along BOLD reference as a source file for provenance
379+
merge_bold_sources = pe.Node(
380+
niu.Merge(2), name='merge_bold_sources', run_without_submitting=True
381+
)
382+
merge_bold_sources.inputs.in1 = bold_series
383+
378384
# Resample to anatomical space
379385
bold_anat_wf = init_bold_volumetric_resample_wf(
380386
metadata=all_metadata[0],
@@ -404,18 +410,19 @@ def init_bold_wf(
404410
('outputnode.bold_minimal', 'inputnode.bold_file'),
405411
('outputnode.motion_xfm', 'inputnode.motion_xfm'),
406412
]),
413+
(bold_fit_wf, merge_bold_sources, [('outputnode.coreg_boldref', 'in2')]),
407414
]) # fmt:skip
408415

409416
# Full derivatives, including resampled BOLD series
410417
if nonstd_spaces.intersection(('anat', 'T1w')):
411418
ds_bold_t1_wf = init_ds_volumes_wf(
419+
source_file=bold_file,
412420
bids_root=str(config.execution.bids_dir),
413421
output_dir=fmriprep_dir,
414422
multiecho=multiecho,
415423
metadata=all_metadata[0],
416424
name='ds_bold_t1_wf',
417425
)
418-
ds_bold_t1_wf.inputs.inputnode.source_files = bold_series
419426
ds_bold_t1_wf.inputs.inputnode.space = 'T1w'
420427

421428
workflow.connect([
@@ -431,6 +438,7 @@ def init_bold_wf(
431438
('outputnode.bold_file', 'inputnode.bold'),
432439
('outputnode.resampling_reference', 'inputnode.ref_file'),
433440
]),
441+
(merge_bold_sources, ds_bold_t1_wf, [('out', 'inputnode.source_files')]),
434442
]) # fmt:skip
435443

436444
if spaces.cached.get_spaces(nonstandard=False, dim=(3,)):
@@ -446,13 +454,13 @@ def init_bold_wf(
446454
name='bold_std_wf',
447455
)
448456
ds_bold_std_wf = init_ds_volumes_wf(
457+
source_file=bold_file,
449458
bids_root=str(config.execution.bids_dir),
450459
output_dir=fmriprep_dir,
451460
multiecho=multiecho,
452461
metadata=all_metadata[0],
453462
name='ds_bold_std_wf',
454463
)
455-
ds_bold_std_wf.inputs.inputnode.source_files = bold_series
456464

457465
workflow.connect([
458466
(inputnode, bold_std_wf, [
@@ -492,6 +500,7 @@ def init_bold_wf(
492500
('outputnode.bold_file', 'inputnode.bold'),
493501
('outputnode.resampling_reference', 'inputnode.ref_file'),
494502
]),
503+
(merge_bold_sources, ds_bold_std_wf, [('out', 'inputnode.source_files')]),
495504
]) # fmt:skip
496505

497506
if config.workflow.run_reconall and freesurfer_spaces:

0 commit comments

Comments
 (0)