@@ -97,6 +97,8 @@ def init_coeff2epi_wf(
9797 from packaging .version import parse as parseversion , Version
9898 from niworkflows .interfaces .fixes import FixHeaderRegistration as Registration
9999
100+ from sdcflows .interfaces import brainmask
101+
100102 workflow = Workflow (name = name )
101103 workflow .__desc__ = """\
102104 The estimated *fieldmap* was then aligned with rigid-registration to the target
@@ -114,6 +116,11 @@ def init_coeff2epi_wf(
114116 name = "outputnode" ,
115117 )
116118
119+ # Dilate only for coregistration purposes
120+ # https://github.com/nipreps/sdcflows/issues/461
121+ dilate_target_mask = pe .Node (brainmask .BinaryDilation (radius = 5 ), name = "dilate_target_mask" )
122+ dilate_fmap_mask = pe .Node (brainmask .BinaryDilation (radius = 5 ), name = "dilate_fmap_mask" )
123+
117124 # Register the reference of the fieldmap to the reference
118125 # of the target image (the one that shall be corrected)
119126 coregister = pe .Node (
@@ -132,11 +139,17 @@ def init_coeff2epi_wf(
132139 # fmt: off
133140 workflow .connect ([
134141 (inputnode , outputnode , [("fmap_coeff" , "fmap_coeff" )]),
142+ (inputnode , dilate_target_mask , [("target_mask" , "in_file" )]),
143+ (inputnode , dilate_fmap_mask , [("fmap_mask" , "in_file" )]),
135144 (inputnode , coregister , [
136145 ("target_ref" , "moving_image" ),
137146 ("fmap_ref" , "fixed_image" ),
138- ("target_mask" , f"moving_image_mask{ mask_trait_s } " ),
139- ("fmap_mask" , f"fixed_image_mask{ mask_trait_s } " ),
147+ ]),
148+ (dilate_target_mask , coregister , [
149+ ("out_file" , f"moving_image_mask{ mask_trait_s } " )
150+ ]),
151+ (dilate_fmap_mask , coregister , [
152+ ("out_file" , f"fixed_image_mask{ mask_trait_s } " )
140153 ]),
141154 (coregister , outputnode , [
142155 ("warped_image" , "target_ref" ),
0 commit comments