Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Restore resampling to T1w target #3116

Merged
merged 19 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ENH: Hook up anatomical derivatives workflow
  • Loading branch information
effigies committed Oct 18, 2023
commit c094f0094e416d4b77f877ac410d852307e374dd
3 changes: 3 additions & 0 deletions fmriprep/workflows/bold/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def init_bold_volumetric_resample_wf(
name='inputnode',
)

outputnode = pe.Node(niu.IdentityInterface(fields=["bold_file"]), name='outputnode')

boldref2target = pe.Node(niu.Merge(2), name='boldref2target')
bold2target = pe.Node(niu.Merge(2), name='bold2target')
resample = pe.Node(ResampleSeries(), name="resample", n_procs=omp_nthreads)
Expand All @@ -70,6 +72,7 @@ def init_bold_volumetric_resample_wf(
]),
(boldref2target, bold2target, [('out', 'in2')]),
(bold2target, resample, [('out', 'transforms')]),
(resample, outputnode, [('out_file', 'bold_file')]),
]) # fmt:skip

if fieldmap_id:
Expand Down
31 changes: 28 additions & 3 deletions fmriprep/workflows/bold/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
from .confounds import init_bold_confs_wf, init_carpetplot_wf
from .fit import init_bold_fit_wf, init_bold_native_wf
from .hmc import init_bold_hmc_wf
from .outputs import init_ds_bold_native_wf, init_func_derivatives_wf
from .outputs import (
init_ds_bold_native_wf,
init_ds_volumes_wf,
init_func_derivatives_wf,
)
from .registration import init_bold_reg_wf, init_bold_t1_trans_wf
from .resampling import (
init_bold_preproc_trans_wf,
Expand Down Expand Up @@ -140,6 +144,7 @@ def init_bold_wf(

fmriprep_dir = config.execution.fmriprep_dir
omp_nthreads = config.nipype.omp_nthreads
all_metadata = [config.execution.layout.get_metadata(file) for file in bold_series]

nvols, mem_gb = _create_mem_gb(bold_file)
if nvols <= 5 - config.execution.sloppy:
Expand Down Expand Up @@ -282,7 +287,7 @@ def init_bold_wf(
bold_output=boldref_out,
echo_output=echos_out,
multiecho=multiecho,
all_metadata=[config.execution.layout.get_metadata(file) for file in bold_series],
all_metadata=all_metadata,
)
ds_bold_native_wf.inputs.inputnode.source_files = bold_series

Expand All @@ -297,7 +302,27 @@ def init_bold_wf(
]),
]) # fmt:skip

anat_out = bool(nonstd_spaces.intersection(('anat', 'T1w')))
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=metadata[0],
)
ds_bold_t1_wf.inputs.inputnode.source_files = bold_series

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
1 change: 0 additions & 1 deletion fmriprep/workflows/bold/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,6 @@ def init_ds_volumes_wf(
*,
bids_root: str,
output_dir: str,
space: str,
multiecho: bool,
metadata: ty.List[dict],
name="ds_bold_native_wf",
Expand Down