Skip to content

Commit ccdd856

Browse files
committed
TST: Denoise anatomicals with ANTS DenoiseImage
1 parent 45405ab commit ccdd856

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

nibabies/workflows/anatomical/preproc.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def init_anat_average_wf(
5757
Path to a reportlet summarizing what happened in this workflow.
5858
5959
"""
60-
from nipype.interfaces.ants import N4BiasFieldCorrection
60+
from nipype.interfaces.ants import DenoiseImage, N4BiasFieldCorrection
6161
from nipype.interfaces.image import Reorient
6262
from niworkflows.engine.workflows import LiterateWorkflow as Workflow
6363
from niworkflows.interfaces.freesurfer import PatchedLTAConvert as LTAConvert
@@ -88,8 +88,17 @@ def init_anat_average_wf(
8888
# 2. Ensure we don't have two timepoints and implicitly squeeze image
8989
split = pe.MapNode(SplitSeries(), iterfield="in_file", name="split")
9090

91-
# 3. INU correction of all independent volumes
91+
# 3. Preclip intensities
9292
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
93102
correct_inu = pe.MapNode(
94103
N4BiasFieldCorrection(
95104
dimension=3,
@@ -108,7 +117,7 @@ def init_anat_average_wf(
108117
IntensityClip(p_min=10.0, p_max=99.5), iterfield="in_file", name="clip_postinu"
109118
)
110119

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
112121
ref_dimensions = pe.Node(TemplateDimensions(), name="ref_dimensions")
113122
conform = pe.MapNode(Conform(), iterfield="in_file", name="conform")
114123
# fmt:off
@@ -117,7 +126,9 @@ def init_anat_average_wf(
117126
(inputnode, validate, [("in_files", "in_file")]),
118127
(validate, split, [("out_file", "in_file")]),
119128
(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")]),
121132
(correct_inu, clip_postinu, [("output_image", "in_file")]),
122133
(ref_dimensions, conform, [
123134
("t1w_valid_list", "in_file"),
@@ -128,7 +139,7 @@ def init_anat_average_wf(
128139
])
129140
# fmt:on
130141

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)
132143
ensure_ras = pe.Node(Reorient(), name="ensure_ras")
133144

134145
if num_maps == 1:
@@ -157,7 +168,7 @@ def init_anat_average_wf(
157168
name="conform_xfm",
158169
)
159170

160-
# 6. StructuralReference is fs.RobustTemplate if > 1 volume, copying otherwise
171+
# 8. StructuralReference is fs.RobustTemplate if > 1 volume, copying otherwise
161172
merge = pe.Node(
162173
StructuralReference(
163174
auto_detect_sensitivity=True,
@@ -172,7 +183,7 @@ def init_anat_average_wf(
172183
name="merge",
173184
)
174185

175-
# 7. Final intensity equalization/conformation
186+
# 9. Final intensity equalization/conformation
176187
clip_final = pe.Node(IntensityClip(p_min=2.0, p_max=99.9), name="clip_final")
177188

178189
merge_xfm = pe.MapNode(

0 commit comments

Comments
 (0)