@@ -97,6 +97,8 @@ def init_coeff2epi_wf(
97
97
from packaging .version import parse as parseversion , Version
98
98
from niworkflows .interfaces .fixes import FixHeaderRegistration as Registration
99
99
100
+ from sdcflows .interfaces import brainmask
101
+
100
102
workflow = Workflow (name = name )
101
103
workflow .__desc__ = """\
102
104
The estimated *fieldmap* was then aligned with rigid-registration to the target
@@ -114,6 +116,11 @@ def init_coeff2epi_wf(
114
116
name = "outputnode" ,
115
117
)
116
118
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
+
117
124
# Register the reference of the fieldmap to the reference
118
125
# of the target image (the one that shall be corrected)
119
126
coregister = pe .Node (
@@ -132,11 +139,17 @@ def init_coeff2epi_wf(
132
139
# fmt: off
133
140
workflow .connect ([
134
141
(inputnode , outputnode , [("fmap_coeff" , "fmap_coeff" )]),
142
+ (inputnode , dilate_target_mask , [("target_mask" , "in_file" )]),
143
+ (inputnode , dilate_fmap_mask , [("fmap_mask" , "in_file" )]),
135
144
(inputnode , coregister , [
136
145
("target_ref" , "moving_image" ),
137
146
("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 } " )
140
153
]),
141
154
(coregister , outputnode , [
142
155
("warped_image" , "target_ref" ),
0 commit comments