Skip to content

Commit

Permalink
Use BIDSURI in init_ds_boldmask_wf (#3297)
Browse files Browse the repository at this point in the history
Closes #3252.

## Changes proposed in this pull request

- Replace `RawSources` in `init_ds_boldmask_wf` with `Sources`
determined using `BIDSURI`.
  • Loading branch information
tsalo authored Jun 4, 2024
1 parent d2f6869 commit 604eeef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion fmriprep/workflows/bold/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ def init_bold_fit_wf(
name='ds_coreg_boldref_wf',
)
ds_boldmask_wf = init_ds_boldmask_wf(
bids_root=layout.root,
output_dir=config.execution.fmriprep_dir,
desc='brain',
name='ds_boldmask_wf',
Expand Down
16 changes: 10 additions & 6 deletions fmriprep/workflows/bold/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from nipype.pipeline import engine as pe
from niworkflows.interfaces.fixes import FixHeaderApplyTransforms as ApplyTransforms
from niworkflows.utils.images import dseg_label
from smriprep.workflows.outputs import _bids_relative

from fmriprep import config
from fmriprep.config import DEFAULT_MEMORY_MIN_GB
Expand Down Expand Up @@ -474,7 +473,6 @@ def init_ds_boldref_wf(

def init_ds_boldmask_wf(
*,
bids_root,
output_dir,
desc: str,
name='ds_boldmask_wf',
Expand All @@ -488,8 +486,14 @@ def init_ds_boldmask_wf(
)
outputnode = pe.Node(niu.IdentityInterface(fields=['boldmask']), name='outputnode')

raw_sources = pe.Node(niu.Function(function=_bids_relative), name='raw_sources')
raw_sources.inputs.bids_root = bids_root
sources = pe.Node(
BIDSURI(
numinputs=1,
dataset_links=config.execution.dataset_links,
out_dir=str(config.execution.fmriprep_dir.absolute()),
),
name='sources',
)

ds_boldmask = pe.Node(
DerivativesDataSink(
Expand All @@ -504,12 +508,12 @@ def init_ds_boldmask_wf(
)

workflow.connect([
(inputnode, raw_sources, [('source_files', 'in_files')]),
(inputnode, sources, [('source_files', 'in1')]),
(inputnode, ds_boldmask, [
('boldmask', 'in_file'),
('source_files', 'source_file'),
]),
(raw_sources, ds_boldmask, [('out', 'RawSources')]),
(sources, ds_boldmask, [('out', 'Sources')]),
(ds_boldmask, outputnode, [('out_file', 'boldmask')]),
]) # fmt:skip

Expand Down

0 comments on commit 604eeef

Please sign in to comment.