Skip to content

Commit

Permalink
RF: Reverse direction of bold-T1w transform
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Nov 3, 2023
1 parent f18b343 commit aad77d3
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions fmriprep/workflows/bold/confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ def init_bold_confs_wf(
Mask of the skull-stripped template image
t1w_tpms
List of tissue probability maps in T1w space
t1_bold_xform
Affine matrix that maps the T1w space into alignment with
the native BOLD space
boldref2anat_xfm
Affine matrix that maps the BOLD reference space into alignment with
the anatomical (T1w) space
Outputs
-------
Expand Down Expand Up @@ -224,7 +224,7 @@ def init_bold_confs_wf(
"skip_vols",
"t1w_mask",
"t1w_tpms",
"t1_bold_xform",
"boldref2anat_xfm",
]
),
name="inputnode",
Expand All @@ -244,7 +244,7 @@ def init_bold_confs_wf(

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

# Resample probseg maps in BOLD space via T1w-to-BOLD transform
# Resample probseg maps in BOLD space via BOLD-to-T1w transform
acc_msk_tfm = pe.MapNode(
ApplyTransforms(interpolation="Gaussian"),
ApplyTransforms(interpolation="Gaussian", invert_transform_flags=[True]),
iterfield=["input_image"],
name="acc_msk_tfm",
mem_gb=0.1,
Expand Down Expand Up @@ -500,7 +500,7 @@ def _select_cols(table):
# Brain mask
(inputnode, t1w_mask_tfm, [("t1w_mask", "input_image"),
("bold_mask", "reference_image"),
("t1_bold_xform", "transforms")]),
("boldref2anat_xfm", "transforms")]),
(inputnode, union_mask, [("bold_mask", "mask1")]),
(t1w_mask_tfm, union_mask, [("output_image", "mask2")]),
(union_mask, dilated_mask, [("out", "in_mask")]),
Expand All @@ -512,7 +512,7 @@ def _select_cols(table):
("skip_vols", "ignore_initial_volumes")]),
(inputnode, acc_masks, [("t1w_tpms", "in_vfs"),
(("bold", _get_zooms), "bold_zooms")]),
(inputnode, acc_msk_tfm, [("t1_bold_xform", "transforms"),
(inputnode, acc_msk_tfm, [("boldref2anat_xfm", "transforms"),
("bold_mask", "reference_image")]),
(inputnode, acc_msk_brain, [("bold_mask", "in_mask")]),
(acc_masks, acc_msk_tfm, [("out_masks", "input_image")]),
Expand Down Expand Up @@ -624,9 +624,9 @@ def init_carpetplot_wf(
BOLD series mask
confounds_file
TSV of all aggregated confounds
t1_bold_xform
Affine matrix that maps the T1w space into alignment with
the native BOLD space
boldref2anat_xfm
Affine matrix that maps the BOLD reference space into alignment with
the anatomical (T1w) space
std2anat_xfm
ANTs-compatible affine-and-warp transform file
cifti_bold
Expand All @@ -653,7 +653,7 @@ def init_carpetplot_wf(
"bold",
"bold_mask",
"confounds_file",
"t1_bold_xform",
"boldref2anat_xfm",
"std2anat_xfm",
"cifti_bold",
"crown_mask",
Expand Down Expand Up @@ -708,6 +708,7 @@ def init_carpetplot_wf(
extension=[".nii", ".nii.gz"],
)
),
invert_transform_flags=[True, False],
interpolation="MultiLabel",
args="-u int",
),
Expand All @@ -720,7 +721,7 @@ def init_carpetplot_wf(

# fmt:off
workflow.connect([
(inputnode, mrg_xfms, [("t1_bold_xform", "in1"),
(inputnode, mrg_xfms, [("boldref2anat_xfm", "in1"),
("std2anat_xfm", "in2")]),
(inputnode, resample_parc, [("bold_mask", "reference_image")]),
(inputnode, parcels, [("crown_mask", "crown_mask")]),
Expand Down

0 comments on commit aad77d3

Please sign in to comment.