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: Dilate fmap and bold masks during coregistration #463

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
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
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
Loading