diff --git a/fmriprep/config.py b/fmriprep/config.py index 4ba1ead2e..6ba0ae1c5 100644 --- a/fmriprep/config.py +++ b/fmriprep/config.py @@ -91,6 +91,8 @@ import os from multiprocessing import set_start_method +from templateflow.conf import TF_LAYOUT + # Disable NiPype etelemetry always _disable_et = bool(os.getenv('NO_ET') is not None or os.getenv('NIPYPE_NO_ET') is not None) os.environ['NIPYPE_NO_ET'] = '1' @@ -525,7 +527,10 @@ def _process_value(value): for k, v in filters.items(): cls.bids_filters[acq][k] = _process_value(v) - dataset_links = {'raw': cls.bids_dir} + dataset_links = { + 'raw': cls.bids_dir, + 'templateflow': Path(TF_LAYOUT.root), + } for deriv_name, deriv_path in cls.derivatives.items(): dataset_links[deriv_name] = deriv_path cls.dataset_links = dataset_links diff --git a/fmriprep/utils/bids.py b/fmriprep/utils/bids.py index 10461dd68..ef58916cc 100644 --- a/fmriprep/utils/bids.py +++ b/fmriprep/utils/bids.py @@ -148,6 +148,8 @@ def write_derivative_description(bids_dir, deriv_dir, dataset_links=None): # Add DatasetLinks if dataset_links: desc['DatasetLinks'] = {k: str(v) for k, v in dataset_links.items()} + if 'templateflow' in dataset_links: + desc['DatasetLinks']['templateflow'] = 'https://github.com/templateflow/templateflow' Path.write_text(deriv_dir / 'dataset_description.json', json.dumps(desc, indent=4)) diff --git a/fmriprep/workflows/bold/base.py b/fmriprep/workflows/bold/base.py index 92cf55338..3249ab247 100644 --- a/fmriprep/workflows/bold/base.py +++ b/fmriprep/workflows/bold/base.py @@ -424,6 +424,8 @@ def init_bold_wf( ('outputnode.bold_mask', 'inputnode.bold_mask'), ('outputnode.coreg_boldref', 'inputnode.bold_ref'), ('outputnode.boldref2anat_xfm', 'inputnode.boldref2anat_xfm'), + ('outputnode.motion_xfm', 'inputnode.motion_xfm'), + ('outputnode.boldref2fmap_xfm', 'inputnode.boldref2fmap_xfm'), ]), (bold_native_wf, ds_bold_t1_wf, [('outputnode.t2star_map', 'inputnode.t2star')]), (bold_anat_wf, ds_bold_t1_wf, [ @@ -474,6 +476,7 @@ def init_bold_wf( ]), (inputnode, ds_bold_std_wf, [ ('anat2std_xfm', 'inputnode.anat2std_xfm'), + ('std_t1w', 'inputnode.template'), ('std_space', 'inputnode.space'), ('std_resolution', 'inputnode.resolution'), ('std_cohort', 'inputnode.cohort'), @@ -482,6 +485,8 @@ def init_bold_wf( ('outputnode.bold_mask', 'inputnode.bold_mask'), ('outputnode.coreg_boldref', 'inputnode.bold_ref'), ('outputnode.boldref2anat_xfm', 'inputnode.boldref2anat_xfm'), + ('outputnode.motion_xfm', 'inputnode.motion_xfm'), + ('outputnode.boldref2fmap_xfm', 'inputnode.boldref2fmap_xfm'), ]), (bold_native_wf, ds_bold_std_wf, [('outputnode.t2star_map', 'inputnode.t2star')]), (bold_std_wf, ds_bold_std_wf, [ diff --git a/fmriprep/workflows/bold/outputs.py b/fmriprep/workflows/bold/outputs.py index e41f356ba..9b8ac2151 100644 --- a/fmriprep/workflows/bold/outputs.py +++ b/fmriprep/workflows/bold/outputs.py @@ -659,6 +659,7 @@ def init_ds_bold_native_wf( ('source_files', 'source_file'), ('bold', 'in_file'), ]), + (sources, ds_bold, [('out', 'Sources')]), ]) # fmt:skip if bold_output and multiecho: @@ -734,6 +735,7 @@ def init_ds_volumes_wf( 'bold_mask', # boldref space 'bold_ref', # boldref space 't2star', # boldref space + 'template', # target reference image from original transform # Anatomical 'boldref2anat_xfm', # Template @@ -742,6 +744,9 @@ def init_ds_volumes_wf( 'space', 'cohort', 'resolution', + # Transforms previously used to generate the outputs + 'motion_xfm', + 'boldref2fmap_xfm', ] ), name='inputnode', @@ -749,7 +754,7 @@ def init_ds_volumes_wf( sources = pe.Node( BIDSURI( - numinputs=3, + numinputs=6, dataset_links=config.execution.dataset_links, out_dir=str(config.execution.fmriprep_dir.absolute()), ), @@ -774,8 +779,11 @@ def init_ds_volumes_wf( workflow.connect([ (inputnode, sources, [ ('source_files', 'in1'), - ('boldref2anat_xfm', 'in2'), - ('anat2std_xfm', 'in3'), + ('motion_xfm', 'in2'), + ('boldref2fmap_xfm', 'in3'), + ('boldref2anat_xfm', 'in4'), + ('anat2std_xfm', 'in5'), + ('template', 'in6'), ]), (inputnode, boldref2target, [ # Note that ANTs expects transforms in target-to-source order