@@ -57,7 +57,7 @@ def init_anat_average_wf(
57
57
Path to a reportlet summarizing what happened in this workflow.
58
58
59
59
"""
60
- from nipype .interfaces .ants import N4BiasFieldCorrection
60
+ from nipype .interfaces .ants import DenoiseImage , N4BiasFieldCorrection
61
61
from nipype .interfaces .image import Reorient
62
62
from niworkflows .engine .workflows import LiterateWorkflow as Workflow
63
63
from niworkflows .interfaces .freesurfer import PatchedLTAConvert as LTAConvert
@@ -88,8 +88,17 @@ def init_anat_average_wf(
88
88
# 2. Ensure we don't have two timepoints and implicitly squeeze image
89
89
split = pe .MapNode (SplitSeries (), iterfield = "in_file" , name = "split" )
90
90
91
- # 3. INU correction of all independent volumes
91
+ # 3. Preclip intensities
92
92
clip_preinu = pe .MapNode (IntensityClip (p_min = 50 ), iterfield = "in_file" , name = "clip_preinu" )
93
+
94
+ # 4. Denoise image
95
+ denoise = pe .MapNode (
96
+ DenoiseImage (dimension = 3 , noise_model = "Rician" ),
97
+ iterfield = "input_image" ,
98
+ name = "denoise" ,
99
+ )
100
+
101
+ # 5. INU correction of all independent volumes
93
102
correct_inu = pe .MapNode (
94
103
N4BiasFieldCorrection (
95
104
dimension = 3 ,
@@ -108,7 +117,7 @@ def init_anat_average_wf(
108
117
IntensityClip (p_min = 10.0 , p_max = 99.5 ), iterfield = "in_file" , name = "clip_postinu"
109
118
)
110
119
111
- # 4 . Reorient T2w image(s) to RAS and resample to common voxel space
120
+ # 6 . Reorient T2w image(s) to RAS and resample to common voxel space
112
121
ref_dimensions = pe .Node (TemplateDimensions (), name = "ref_dimensions" )
113
122
conform = pe .MapNode (Conform (), iterfield = "in_file" , name = "conform" )
114
123
# fmt:off
@@ -117,7 +126,9 @@ def init_anat_average_wf(
117
126
(inputnode , validate , [("in_files" , "in_file" )]),
118
127
(validate , split , [("out_file" , "in_file" )]),
119
128
(split , clip_preinu , [(("out_files" , _flatten ), "in_file" )]),
120
- (clip_preinu , correct_inu , [("out_file" , "input_image" )]),
129
+ (clip_preinu , denoise , [("out_file" , "input_image" )]),
130
+ (denoise , correct_inu , [("output_image" , "input_image" )]),
131
+ # (clip_preinu, correct_inu, [("out_file", "input_image")]),
121
132
(correct_inu , clip_postinu , [("output_image" , "in_file" )]),
122
133
(ref_dimensions , conform , [
123
134
("t1w_valid_list" , "in_file" ),
@@ -128,7 +139,7 @@ def init_anat_average_wf(
128
139
])
129
140
# fmt:on
130
141
131
- # 5 . Reorient template to RAS, if needed (mri_robust_template may set to LIA)
142
+ # 7 . Reorient template to RAS, if needed (mri_robust_template may set to LIA)
132
143
ensure_ras = pe .Node (Reorient (), name = "ensure_ras" )
133
144
134
145
if num_maps == 1 :
@@ -157,7 +168,7 @@ def init_anat_average_wf(
157
168
name = "conform_xfm" ,
158
169
)
159
170
160
- # 6 . StructuralReference is fs.RobustTemplate if > 1 volume, copying otherwise
171
+ # 8 . StructuralReference is fs.RobustTemplate if > 1 volume, copying otherwise
161
172
merge = pe .Node (
162
173
StructuralReference (
163
174
auto_detect_sensitivity = True ,
@@ -172,7 +183,7 @@ def init_anat_average_wf(
172
183
name = "merge" ,
173
184
)
174
185
175
- # 7 . Final intensity equalization/conformation
186
+ # 9 . Final intensity equalization/conformation
176
187
clip_final = pe .Node (IntensityClip (p_min = 2.0 , p_max = 99.9 ), name = "clip_final" )
177
188
178
189
merge_xfm = pe .MapNode (
0 commit comments