Skip to content

Commit

Permalink
RF: Move resampling to "full" section
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Oct 23, 2023
1 parent 9bcfdac commit 26d141f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
50 changes: 26 additions & 24 deletions fmriprep/workflows/bold/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def init_bold_wf(
]) # fmt:skip

boldref_out = bool(nonstd_spaces.intersection(('func', 'run', 'bold', 'boldref', 'sbref')))
boldref_out |= config.workflow.level == 'full'

Check warning on line 295 in fmriprep/workflows/bold/base.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/workflows/bold/base.py#L295

Added line #L295 was not covered by tests
echos_out = multiecho and config.execution.me_output_echos

if boldref_out or echos_out:
Expand All @@ -316,30 +317,6 @@ def init_bold_wf(
]),
]) # fmt:skip

if nonstd_spaces.intersection(('anat', 'T1w')):
ds_bold_t1_wf = init_ds_volumes_wf(
bids_root=str(config.execution.bids_dir),
output_dir=fmriprep_dir,
multiecho=multiecho,
metadata=all_metadata[0],
name='ds_bold_t1_wf',
)
ds_bold_t1_wf.inputs.inputnode.source_files = bold_series
ds_bold_t1_wf.inputs.inputnode.space = 'T1w'

workflow.connect([
(inputnode, ds_bold_t1_wf, [
('t1w_preproc', 'inputnode.ref_file'),
]),
(bold_fit_wf, ds_bold_t1_wf, [
('outputnode.bold_mask', 'inputnode.bold_mask'),
('outputnode.coreg_boldref', 'inputnode.bold_ref'),
('outputnode.boldref2anat_xfm', 'inputnode.boldref2anat_xfm'),
]),
(bold_native_wf, ds_bold_t1_wf, [('outputnode.t2star_map', 'inputnode.t2star')]),
(bold_anat_wf, ds_bold_t1_wf, [('outputnode.bold_file', 'inputnode.bold')]),
]) # fmt:skip

if multiecho:
t2s_reporting_wf = init_t2s_reporting_wf()

Expand Down Expand Up @@ -379,6 +356,31 @@ def init_bold_wf(
if config.workflow.level == "resampling":
return workflow

# Full derivatives, including resampled BOLD series
if nonstd_spaces.intersection(('anat', 'T1w')):
ds_bold_t1_wf = init_ds_volumes_wf(

Check warning on line 361 in fmriprep/workflows/bold/base.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/workflows/bold/base.py#L360-L361

Added lines #L360 - L361 were not covered by tests
bids_root=str(config.execution.bids_dir),
output_dir=fmriprep_dir,
multiecho=multiecho,
metadata=all_metadata[0],
name='ds_bold_t1_wf',
)
ds_bold_t1_wf.inputs.inputnode.source_files = bold_series
ds_bold_t1_wf.inputs.inputnode.space = 'T1w'

Check warning on line 369 in fmriprep/workflows/bold/base.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/workflows/bold/base.py#L368-L369

Added lines #L368 - L369 were not covered by tests

workflow.connect([

Check warning on line 371 in fmriprep/workflows/bold/base.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/workflows/bold/base.py#L371

Added line #L371 was not covered by tests
(inputnode, ds_bold_t1_wf, [
('t1w_preproc', 'inputnode.ref_file'),
]),
(bold_fit_wf, ds_bold_t1_wf, [
('outputnode.bold_mask', 'inputnode.bold_mask'),
('outputnode.coreg_boldref', 'inputnode.bold_ref'),
('outputnode.boldref2anat_xfm', 'inputnode.boldref2anat_xfm'),
]),
(bold_native_wf, ds_bold_t1_wf, [('outputnode.t2star_map', 'inputnode.t2star')]),
(bold_anat_wf, ds_bold_t1_wf, [('outputnode.bold_file', 'inputnode.bold')]),
]) # fmt:skip

# Fill-in datasinks of reportlets seen so far
for node in workflow.list_node_names():
if node.split(".")[-1].startswith("ds_report"):
Expand Down
42 changes: 21 additions & 21 deletions fmriprep/workflows/bold/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,27 @@ def init_ds_bold_native_wf(
raw_sources.inputs.bids_root = bids_root
workflow.connect(inputnode, 'source_files', raw_sources, 'in_files')

# Masks should be output if any other derivatives are output
ds_bold_mask = pe.Node(

Check warning on line 591 in fmriprep/workflows/bold/outputs.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/workflows/bold/outputs.py#L591

Added line #L591 was not covered by tests
DerivativesDataSink(
base_directory=output_dir,
desc='brain',
suffix='mask',
compress=True,
dismiss_entities=("echo",),
),
name='ds_bold_mask',
run_without_submitting=True,
mem_gb=DEFAULT_MEMORY_MIN_GB,
)
workflow.connect([

Check warning on line 603 in fmriprep/workflows/bold/outputs.py

View check run for this annotation

Codecov / codecov/patch

fmriprep/workflows/bold/outputs.py#L603

Added line #L603 was not covered by tests
(inputnode, ds_bold_mask, [
('source_files', 'source_file'),
('bold_mask', 'in_file'),
]),
(raw_sources, ds_bold_mask, [('out', 'RawSources')]),
]) # fmt:skip

if bold_output:
ds_bold = pe.Node(
DerivativesDataSink(
Expand All @@ -609,27 +630,6 @@ def init_ds_bold_native_wf(
]),
]) # fmt:skip

if bold_output or echo_output:
ds_bold_mask = pe.Node(
DerivativesDataSink(
base_directory=output_dir,
desc='brain',
suffix='mask',
compress=True,
dismiss_entities=("echo",),
),
name='ds_bold_mask',
run_without_submitting=True,
mem_gb=DEFAULT_MEMORY_MIN_GB,
)
workflow.connect([
(inputnode, ds_bold_mask, [
('source_files', 'source_file'),
('bold_mask', 'in_file'),
]),
(raw_sources, ds_bold_mask, [('out', 'RawSources')]),
]) # fmt:skip

if bold_output and multiecho:
t2star_meta = {
'Units': 's',
Expand Down

0 comments on commit 26d141f

Please sign in to comment.