Skip to content

Commit

Permalink
Dilate fmap and epi masks before coregistration
Browse files Browse the repository at this point in the history
  • Loading branch information
psadil authored and effigies committed Oct 3, 2024
1 parent 18e5e95 commit 85e0197
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions sdcflows/workflows/apply/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def init_coeff2epi_wf(
from packaging.version import parse as parseversion, Version
from niworkflows.interfaces.fixes import FixHeaderRegistration as Registration

from sdcflows.interfaces import brainmask

workflow = Workflow(name=name)
workflow.__desc__ = """\
The estimated *fieldmap* was then aligned with rigid-registration to the target
Expand All @@ -114,6 +116,11 @@ def init_coeff2epi_wf(
name="outputnode",
)

# Dilate only for coregistration purposes
# https://github.com/nipreps/sdcflows/issues/461
dilate_target_mask = pe.Node(brainmask.BinaryDilation(radius=5), name="dilate_target_mask")
dilate_fmap_mask = pe.Node(brainmask.BinaryDilation(radius=5), name="dilate_fmap_mask")

# Register the reference of the fieldmap to the reference
# of the target image (the one that shall be corrected)
coregister = pe.Node(
Expand All @@ -132,11 +139,17 @@ def init_coeff2epi_wf(
# fmt: off
workflow.connect([
(inputnode, outputnode, [("fmap_coeff", "fmap_coeff")]),
(inputnode, dilate_target_mask, [("target_mask", "in_file")]),
(inputnode, dilate_fmap_mask, [("fmap_mask", "in_file")]),
(inputnode, coregister, [
("target_ref", "moving_image"),
("fmap_ref", "fixed_image"),
("target_mask", f"moving_image_mask{mask_trait_s}"),
("fmap_mask", f"fixed_image_mask{mask_trait_s}"),
]),
(dilate_target_mask, coregister, [
("out_file", f"moving_image_mask{mask_trait_s}")
]),
(dilate_fmap_mask, coregister, [
("out_file", f"fixed_image_mask{mask_trait_s}")
]),
(coregister, outputnode, [
("warped_image", "target_ref"),
Expand Down

0 comments on commit 85e0197

Please sign in to comment.