Skip to content

Commit 26d141f

Browse files
committed
RF: Move resampling to "full" section
1 parent 9bcfdac commit 26d141f

File tree

2 files changed

+47
-45
lines changed

2 files changed

+47
-45
lines changed

fmriprep/workflows/bold/base.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ def init_bold_wf(
292292
]) # fmt:skip
293293

294294
boldref_out = bool(nonstd_spaces.intersection(('func', 'run', 'bold', 'boldref', 'sbref')))
295+
boldref_out |= config.workflow.level == 'full'
295296
echos_out = multiecho and config.execution.me_output_echos
296297

297298
if boldref_out or echos_out:
@@ -316,30 +317,6 @@ def init_bold_wf(
316317
]),
317318
]) # fmt:skip
318319

319-
if nonstd_spaces.intersection(('anat', 'T1w')):
320-
ds_bold_t1_wf = init_ds_volumes_wf(
321-
bids_root=str(config.execution.bids_dir),
322-
output_dir=fmriprep_dir,
323-
multiecho=multiecho,
324-
metadata=all_metadata[0],
325-
name='ds_bold_t1_wf',
326-
)
327-
ds_bold_t1_wf.inputs.inputnode.source_files = bold_series
328-
ds_bold_t1_wf.inputs.inputnode.space = 'T1w'
329-
330-
workflow.connect([
331-
(inputnode, ds_bold_t1_wf, [
332-
('t1w_preproc', 'inputnode.ref_file'),
333-
]),
334-
(bold_fit_wf, ds_bold_t1_wf, [
335-
('outputnode.bold_mask', 'inputnode.bold_mask'),
336-
('outputnode.coreg_boldref', 'inputnode.bold_ref'),
337-
('outputnode.boldref2anat_xfm', 'inputnode.boldref2anat_xfm'),
338-
]),
339-
(bold_native_wf, ds_bold_t1_wf, [('outputnode.t2star_map', 'inputnode.t2star')]),
340-
(bold_anat_wf, ds_bold_t1_wf, [('outputnode.bold_file', 'inputnode.bold')]),
341-
]) # fmt:skip
342-
343320
if multiecho:
344321
t2s_reporting_wf = init_t2s_reporting_wf()
345322

@@ -379,6 +356,31 @@ def init_bold_wf(
379356
if config.workflow.level == "resampling":
380357
return workflow
381358

359+
# Full derivatives, including resampled BOLD series
360+
if nonstd_spaces.intersection(('anat', 'T1w')):
361+
ds_bold_t1_wf = init_ds_volumes_wf(
362+
bids_root=str(config.execution.bids_dir),
363+
output_dir=fmriprep_dir,
364+
multiecho=multiecho,
365+
metadata=all_metadata[0],
366+
name='ds_bold_t1_wf',
367+
)
368+
ds_bold_t1_wf.inputs.inputnode.source_files = bold_series
369+
ds_bold_t1_wf.inputs.inputnode.space = 'T1w'
370+
371+
workflow.connect([
372+
(inputnode, ds_bold_t1_wf, [
373+
('t1w_preproc', 'inputnode.ref_file'),
374+
]),
375+
(bold_fit_wf, ds_bold_t1_wf, [
376+
('outputnode.bold_mask', 'inputnode.bold_mask'),
377+
('outputnode.coreg_boldref', 'inputnode.bold_ref'),
378+
('outputnode.boldref2anat_xfm', 'inputnode.boldref2anat_xfm'),
379+
]),
380+
(bold_native_wf, ds_bold_t1_wf, [('outputnode.t2star_map', 'inputnode.t2star')]),
381+
(bold_anat_wf, ds_bold_t1_wf, [('outputnode.bold_file', 'inputnode.bold')]),
382+
]) # fmt:skip
383+
382384
# Fill-in datasinks of reportlets seen so far
383385
for node in workflow.list_node_names():
384386
if node.split(".")[-1].startswith("ds_report"):

fmriprep/workflows/bold/outputs.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,27 @@ def init_ds_bold_native_wf(
587587
raw_sources.inputs.bids_root = bids_root
588588
workflow.connect(inputnode, 'source_files', raw_sources, 'in_files')
589589

590+
# Masks should be output if any other derivatives are output
591+
ds_bold_mask = pe.Node(
592+
DerivativesDataSink(
593+
base_directory=output_dir,
594+
desc='brain',
595+
suffix='mask',
596+
compress=True,
597+
dismiss_entities=("echo",),
598+
),
599+
name='ds_bold_mask',
600+
run_without_submitting=True,
601+
mem_gb=DEFAULT_MEMORY_MIN_GB,
602+
)
603+
workflow.connect([
604+
(inputnode, ds_bold_mask, [
605+
('source_files', 'source_file'),
606+
('bold_mask', 'in_file'),
607+
]),
608+
(raw_sources, ds_bold_mask, [('out', 'RawSources')]),
609+
]) # fmt:skip
610+
590611
if bold_output:
591612
ds_bold = pe.Node(
592613
DerivativesDataSink(
@@ -609,27 +630,6 @@ def init_ds_bold_native_wf(
609630
]),
610631
]) # fmt:skip
611632

612-
if bold_output or echo_output:
613-
ds_bold_mask = pe.Node(
614-
DerivativesDataSink(
615-
base_directory=output_dir,
616-
desc='brain',
617-
suffix='mask',
618-
compress=True,
619-
dismiss_entities=("echo",),
620-
),
621-
name='ds_bold_mask',
622-
run_without_submitting=True,
623-
mem_gb=DEFAULT_MEMORY_MIN_GB,
624-
)
625-
workflow.connect([
626-
(inputnode, ds_bold_mask, [
627-
('source_files', 'source_file'),
628-
('bold_mask', 'in_file'),
629-
]),
630-
(raw_sources, ds_bold_mask, [('out', 'RawSources')]),
631-
]) # fmt:skip
632-
633633
if bold_output and multiecho:
634634
t2star_meta = {
635635
'Units': 's',

0 commit comments

Comments
 (0)