Skip to content

Commit e7672df

Browse files
committed
RF: Reverse direction of bold-T1w transform
1 parent ce7c65f commit e7672df

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

fmriprep/workflows/bold/confounds.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ def init_bold_confs_wf(
128128
Mask of the skull-stripped template image
129129
t1w_tpms
130130
List of tissue probability maps in T1w space
131-
t1_bold_xform
132-
Affine matrix that maps the T1w space into alignment with
133-
the native BOLD space
131+
boldref2anat_xfm
132+
Affine matrix that maps the BOLD reference space into alignment with
133+
the anatomical (T1w) space
134134
135135
Outputs
136136
-------
@@ -224,7 +224,7 @@ def init_bold_confs_wf(
224224
"skip_vols",
225225
"t1w_mask",
226226
"t1w_tpms",
227-
"t1_bold_xform",
227+
"boldref2anat_xfm",
228228
]
229229
),
230230
name="inputnode",
@@ -244,7 +244,7 @@ def init_bold_confs_wf(
244244

245245
# Project T1w mask into BOLD space and merge with BOLD brainmask
246246
t1w_mask_tfm = pe.Node(
247-
ApplyTransforms(interpolation="MultiLabel"),
247+
ApplyTransforms(interpolation="MultiLabel", invert_transform_flags=[True]),
248248
name="t1w_mask_tfm",
249249
)
250250
union_mask = pe.Node(niu.Function(function=_binary_union), name="union_mask")
@@ -266,9 +266,9 @@ def init_bold_confs_wf(
266266
# Generate aCompCor probseg maps
267267
acc_masks = pe.Node(aCompCorMasks(is_aseg=freesurfer), name="acc_masks")
268268

269-
# Resample probseg maps in BOLD space via T1w-to-BOLD transform
269+
# Resample probseg maps in BOLD space via BOLD-to-T1w transform
270270
acc_msk_tfm = pe.MapNode(
271-
ApplyTransforms(interpolation="Gaussian"),
271+
ApplyTransforms(interpolation="Gaussian", invert_transform_flags=[True]),
272272
iterfield=["input_image"],
273273
name="acc_msk_tfm",
274274
mem_gb=0.1,
@@ -500,7 +500,7 @@ def _select_cols(table):
500500
# Brain mask
501501
(inputnode, t1w_mask_tfm, [("t1w_mask", "input_image"),
502502
("bold_mask", "reference_image"),
503-
("t1_bold_xform", "transforms")]),
503+
("boldref2anat_xfm", "transforms")]),
504504
(inputnode, union_mask, [("bold_mask", "mask1")]),
505505
(t1w_mask_tfm, union_mask, [("output_image", "mask2")]),
506506
(union_mask, dilated_mask, [("out", "in_mask")]),
@@ -512,7 +512,7 @@ def _select_cols(table):
512512
("skip_vols", "ignore_initial_volumes")]),
513513
(inputnode, acc_masks, [("t1w_tpms", "in_vfs"),
514514
(("bold", _get_zooms), "bold_zooms")]),
515-
(inputnode, acc_msk_tfm, [("t1_bold_xform", "transforms"),
515+
(inputnode, acc_msk_tfm, [("boldref2anat_xfm", "transforms"),
516516
("bold_mask", "reference_image")]),
517517
(inputnode, acc_msk_brain, [("bold_mask", "in_mask")]),
518518
(acc_masks, acc_msk_tfm, [("out_masks", "input_image")]),
@@ -624,9 +624,9 @@ def init_carpetplot_wf(
624624
BOLD series mask
625625
confounds_file
626626
TSV of all aggregated confounds
627-
t1_bold_xform
628-
Affine matrix that maps the T1w space into alignment with
629-
the native BOLD space
627+
boldref2anat_xfm
628+
Affine matrix that maps the BOLD reference space into alignment with
629+
the anatomical (T1w) space
630630
std2anat_xfm
631631
ANTs-compatible affine-and-warp transform file
632632
cifti_bold
@@ -653,7 +653,7 @@ def init_carpetplot_wf(
653653
"bold",
654654
"bold_mask",
655655
"confounds_file",
656-
"t1_bold_xform",
656+
"boldref2anat_xfm",
657657
"std2anat_xfm",
658658
"cifti_bold",
659659
"crown_mask",
@@ -708,6 +708,7 @@ def init_carpetplot_wf(
708708
extension=[".nii", ".nii.gz"],
709709
)
710710
),
711+
invert_transform_flags=[True, False],
711712
interpolation="MultiLabel",
712713
args="-u int",
713714
),
@@ -720,7 +721,7 @@ def init_carpetplot_wf(
720721

721722
# fmt:off
722723
workflow.connect([
723-
(inputnode, mrg_xfms, [("t1_bold_xform", "in1"),
724+
(inputnode, mrg_xfms, [("boldref2anat_xfm", "in1"),
724725
("std2anat_xfm", "in2")]),
725726
(inputnode, resample_parc, [("bold_mask", "reference_image")]),
726727
(inputnode, parcels, [("crown_mask", "crown_mask")]),

0 commit comments

Comments
 (0)