Skip to content

Commit 2e863b7

Browse files
committed
Merge tag '23.2.3'
23.2.3 (May 20, 2024) Bug fix release in the 23.2.x series. Writes brain masks in ``space-boldref`` with ``--level minimal``, bringing behavior in line with documentation. * FIX: Write out boldref-space brain mask with minimal level (#3292)
2 parents 3dfd569 + 672c46a commit 2e863b7

File tree

8 files changed

+80
-31
lines changed

8 files changed

+80
-31
lines changed

.circleci/ds005_fasttrack_outputs.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ sub-01/anat/sub-01_hemi-R_desc-reg_sphere.surf.gii
2323
sub-01/anat/sub-01_hemi-R_space-fsLR_desc-msmsulc_sphere.surf.gii
2424
sub-01/anat/sub-01_hemi-R_space-fsLR_desc-reg_sphere.surf.gii
2525
sub-01/func
26+
sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-brain_mask.json
27+
sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-brain_mask.nii.gz
2628
sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-confounds_timeseries.json
2729
sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-confounds_timeseries.tsv
2830
sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-coreg_boldref.json
@@ -41,6 +43,8 @@ sub-01/func/sub-01_task-mixedgamblestask_run-01_hemi-R_space-fsaverage5_bold.fun
4143
sub-01/func/sub-01_task-mixedgamblestask_run-01_hemi-R_space-fsaverage5_bold.json
4244
sub-01/func/sub-01_task-mixedgamblestask_run-01_hemi-R_space-fsnative_bold.func.gii
4345
sub-01/func/sub-01_task-mixedgamblestask_run-01_hemi-R_space-fsnative_bold.json
46+
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-brain_mask.json
47+
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-brain_mask.nii.gz
4448
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_timeseries.json
4549
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_timeseries.tsv
4650
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-coreg_boldref.json

.circleci/ds005_outputs.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ sub-01/anat/sub-01_label-CSF_probseg.nii.gz
4343
sub-01/anat/sub-01_label-GM_probseg.nii.gz
4444
sub-01/anat/sub-01_label-WM_probseg.nii.gz
4545
sub-01/func
46+
sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-brain_mask.json
47+
sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-brain_mask.nii.gz
4648
sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-confounds_timeseries.json
4749
sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-confounds_timeseries.tsv
4850
sub-01/func/sub-01_task-mixedgamblestask_run-01_desc-coreg_boldref.json
@@ -61,6 +63,8 @@ sub-01/func/sub-01_task-mixedgamblestask_run-01_hemi-R_space-fsaverage5_bold.fun
6163
sub-01/func/sub-01_task-mixedgamblestask_run-01_hemi-R_space-fsaverage5_bold.json
6264
sub-01/func/sub-01_task-mixedgamblestask_run-01_hemi-R_space-fsnative_bold.func.gii
6365
sub-01/func/sub-01_task-mixedgamblestask_run-01_hemi-R_space-fsnative_bold.json
66+
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-brain_mask.json
67+
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-brain_mask.nii.gz
6468
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_timeseries.json
6569
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_timeseries.tsv
6670
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-coreg_boldref.json

.circleci/ds005_partial_fasttrack_outputs.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz
5151
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-preproc_fieldmap.json
5252
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-preproc_fieldmap.nii.gz
5353
sub-01/func
54+
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-brain_mask.json
55+
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-brain_mask.nii.gz
5456
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_timeseries.json
5557
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_timeseries.tsv
5658
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-coreg_boldref.json

.circleci/ds005_partial_outputs.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz
7373
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-preproc_fieldmap.json
7474
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-preproc_fieldmap.nii.gz
7575
sub-01/func
76+
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-brain_mask.json
77+
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-brain_mask.nii.gz
7678
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_timeseries.json
7779
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-confounds_timeseries.tsv
7880
sub-01/func/sub-01_task-mixedgamblestask_run-02_desc-coreg_boldref.json

CHANGES.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
23.2.3 (May 20, 2024)
2+
=====================
3+
Bug fix release in the 23.2.x series.
4+
5+
Writes brain masks in ``space-boldref`` with ``--level minimal``,
6+
bringing behavior in line with documentation.
7+
8+
* FIX: Write out boldref-space brain mask with minimal level (#3292)
9+
10+
111
23.2.2 (May 06, 2024)
212
=====================
313
Bug fix release in the 23.2.x series.

fmriprep/workflows/bold/base.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,6 @@ def init_bold_wf(
326326
ds_bold_native_wf.inputs.inputnode.source_files = bold_series
327327

328328
workflow.connect([
329-
(bold_fit_wf, ds_bold_native_wf, [
330-
('outputnode.bold_mask', 'inputnode.bold_mask'),
331-
('outputnode.motion_xfm', 'inputnode.motion_xfm'),
332-
('outputnode.boldref2fmap_xfm', 'inputnode.boldref2fmap_xfm'),
333-
]),
334329
(bold_native_wf, ds_bold_native_wf, [
335330
('outputnode.bold_native', 'inputnode.bold'),
336331
('outputnode.bold_echos', 'inputnode.bold_echos'),

fmriprep/workflows/bold/fit.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
# BOLD workflows
4848
from .hmc import init_bold_hmc_wf
4949
from .outputs import (
50+
init_ds_boldmask_wf,
5051
init_ds_boldref_wf,
5152
init_ds_hmc_wf,
5253
init_ds_registration_wf,
@@ -472,6 +473,13 @@ def init_bold_fit_wf(
472473
desc='coreg',
473474
name='ds_coreg_boldref_wf',
474475
)
476+
ds_boldmask_wf = init_ds_boldmask_wf(
477+
bids_root=layout.root,
478+
output_dir=config.execution.fmriprep_dir,
479+
desc='brain',
480+
name='ds_boldmask_wf',
481+
)
482+
ds_boldmask_wf.inputs.inputnode.source_files = [bold_file]
475483

476484
workflow.connect([
477485
(hmcref_buffer, fmapref_buffer, [('boldref', 'boldref_files')]),
@@ -480,6 +488,7 @@ def init_bold_fit_wf(
480488
('in_file', 'inputnode.source_files'),
481489
]),
482490
(ds_coreg_boldref_wf, regref_buffer, [('outputnode.boldref', 'boldref')]),
491+
(ds_boldmask_wf, regref_buffer, [('outputnode.boldmask', 'boldmask')]),
483492
(fmapref_buffer, func_fit_reports_wf, [('out', 'inputnode.sdc_boldref')]),
484493
]) # fmt:skip
485494

@@ -562,8 +571,8 @@ def init_bold_fit_wf(
562571
(unwarp_wf, ds_coreg_boldref_wf, [
563572
('outputnode.corrected', 'inputnode.boldref'),
564573
]),
565-
(unwarp_wf, regref_buffer, [
566-
('outputnode.corrected_mask', 'boldmask'),
574+
(unwarp_wf, ds_boldmask_wf, [
575+
('outputnode.corrected_mask', 'inputnode.boldmask'),
567576
]),
568577
(fmap_select, func_fit_reports_wf, [('fmap_ref', 'inputnode.fmap_ref')]),
569578
(fmap_select, summary, [('sdc_method', 'distortion_correction')]),
@@ -579,8 +588,8 @@ def init_bold_fit_wf(
579588
(enhance_boldref_wf, ds_coreg_boldref_wf, [
580589
('outputnode.bias_corrected_file', 'inputnode.boldref'),
581590
]),
582-
(enhance_boldref_wf, regref_buffer, [
583-
('outputnode.mask_file', 'boldmask'),
591+
(enhance_boldref_wf, ds_boldmask_wf, [
592+
('outputnode.mask_file', 'inputnode.boldmask'),
584593
]),
585594
])
586595
# fmt:on

fmriprep/workflows/bold/outputs.py

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from nipype.pipeline import engine as pe
3030
from niworkflows.interfaces.fixes import FixHeaderApplyTransforms as ApplyTransforms
3131
from niworkflows.utils.images import dseg_label
32+
from smriprep.workflows.outputs import _bids_relative
3233

3334
from fmriprep import config
3435
from fmriprep.config import DEFAULT_MEMORY_MIN_GB
@@ -471,6 +472,50 @@ def init_ds_boldref_wf(
471472
return workflow
472473

473474

475+
def init_ds_boldmask_wf(
476+
*,
477+
bids_root,
478+
output_dir,
479+
desc: str,
480+
name='ds_boldmask_wf',
481+
) -> pe.Workflow:
482+
"""Write out a BOLD mask."""
483+
workflow = pe.Workflow(name=name)
484+
485+
inputnode = pe.Node(
486+
niu.IdentityInterface(fields=['source_files', 'boldmask']),
487+
name='inputnode',
488+
)
489+
outputnode = pe.Node(niu.IdentityInterface(fields=['boldmask']), name='outputnode')
490+
491+
raw_sources = pe.Node(niu.Function(function=_bids_relative), name='raw_sources')
492+
raw_sources.inputs.bids_root = bids_root
493+
494+
ds_boldmask = pe.Node(
495+
DerivativesDataSink(
496+
base_directory=output_dir,
497+
desc=desc,
498+
suffix='mask',
499+
compress=True,
500+
dismiss_entities=dismiss_echo(),
501+
),
502+
name='ds_boldmask',
503+
run_without_submitting=True,
504+
)
505+
506+
workflow.connect([
507+
(inputnode, raw_sources, [('source_files', 'in_files')]),
508+
(inputnode, ds_boldmask, [
509+
('boldmask', 'in_file'),
510+
('source_files', 'source_file'),
511+
]),
512+
(raw_sources, ds_boldmask, [('out', 'RawSources')]),
513+
(ds_boldmask, outputnode, [('out_file', 'boldmask')]),
514+
]) # fmt:skip
515+
516+
return workflow
517+
518+
474519
def init_ds_registration_wf(
475520
*,
476521
bids_root: str,
@@ -592,7 +637,6 @@ def init_ds_bold_native_wf(
592637
fields=[
593638
'source_files',
594639
'bold',
595-
'bold_mask',
596640
'bold_echos',
597641
't2star',
598642
# Transforms previously used to generate the outputs
@@ -619,27 +663,6 @@ def init_ds_bold_native_wf(
619663
]),
620664
]) # fmt:skip
621665

622-
# Masks should be output if any other derivatives are output
623-
ds_bold_mask = pe.Node(
624-
DerivativesDataSink(
625-
base_directory=output_dir,
626-
desc='brain',
627-
suffix='mask',
628-
compress=True,
629-
dismiss_entities=dismiss_echo(),
630-
),
631-
name='ds_bold_mask',
632-
run_without_submitting=True,
633-
mem_gb=DEFAULT_MEMORY_MIN_GB,
634-
)
635-
workflow.connect([
636-
(inputnode, ds_bold_mask, [
637-
('source_files', 'source_file'),
638-
('bold_mask', 'in_file'),
639-
]),
640-
(sources, ds_bold_mask, [('out', 'Sources')]),
641-
]) # fmt:skip
642-
643666
if bold_output:
644667
ds_bold = pe.Node(
645668
DerivativesDataSink(

0 commit comments

Comments
 (0)