Skip to content

Commit 5475910

Browse files
committed
RF: Remove alternate precomputed mask workflow
1 parent 993f44c commit 5475910

File tree

2 files changed

+1
-55
lines changed

2 files changed

+1
-55
lines changed

nibabies/workflows/anatomical/base.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ def init_infant_anat_wf(
8282
from niworkflows.engine.workflows import LiterateWorkflow as Workflow
8383

8484
from ...utils.misc import fix_multi_source_name
85-
from .brain_extraction import (
86-
init_infant_brain_extraction_wf,
87-
init_precomputed_mask_wf,
88-
)
85+
from .brain_extraction import init_infant_brain_extraction_wf
8986
from .norm import init_anat_norm_wf
9087
from .outputs import (
9188
init_anat_derivatives_wf,

nibabies/workflows/anatomical/brain_extraction.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -249,57 +249,6 @@ def init_infant_brain_extraction_wf(
249249
return workflow
250250

251251

252-
def init_precomputed_mask_wf(
253-
bspline_fitting_distance=200, omp_nthreads=None, name="precomputed_mask_wf"
254-
):
255-
from nipype.interfaces.ants import N4BiasFieldCorrection
256-
from niworkflows.interfaces.header import CopyXForm, ValidateImage
257-
from niworkflows.interfaces.nibabel import ApplyMask, IntensityClip
258-
259-
workflow = pe.Workflow(name=name)
260-
inputnode = pe.Node(niu.IdentityInterface(fields=["t1w", "t1w_mask"]), name="inputnode")
261-
outputnode = pe.Node(
262-
niu.IdentityInterface(fields=["t1w_preproc", "t1w_mask", "t1w_brain"]),
263-
name="outputnode",
264-
)
265-
266-
validate_mask = pe.Node(ValidateImage(), name="validate_mask")
267-
fix_hdr = pe.Node(CopyXForm(), mem_gb=0.1, name="fix_hdr")
268-
final_n4 = pe.Node(
269-
N4BiasFieldCorrection(
270-
dimension=3,
271-
bspline_fitting_distance=bspline_fitting_distance,
272-
save_bias=True,
273-
copy_header=True,
274-
n_iterations=[50] * 5,
275-
convergence_threshold=1e-7,
276-
rescale_intensities=True,
277-
shrink_factor=4,
278-
),
279-
n_procs=omp_nthreads,
280-
name="final_n4",
281-
)
282-
final_clip = pe.Node(IntensityClip(p_min=5.0, p_max=99.5), name="final_clip")
283-
apply_mask = pe.Node(ApplyMask(), name="apply_mask")
284-
285-
# fmt:off
286-
workflow.connect([
287-
(inputnode, validate_mask, [("t1w_mask", "in_file")]),
288-
(validate_mask, fix_hdr, [("out_file", "in_file")]),
289-
(inputnode, fix_hdr, [("t1w", "hdr_file")]),
290-
(inputnode, final_n4, [("t1w", "input_image")]),
291-
(fix_hdr, final_n4, [("out_file", "weight_image")]),
292-
(fix_hdr, apply_mask, [("out_file", "in_mask")]),
293-
(final_n4, apply_mask, [("output_image", "in_file")]),
294-
(final_n4, final_clip, [("output_image", "in_file")]),
295-
(fix_hdr, outputnode, [("out_file", "t1w_mask")]),
296-
(final_clip, outputnode, [("out_file", "t1w_preproc")]),
297-
(apply_mask, outputnode, [("out_file", "t1w_brain")]),
298-
])
299-
# fmt:on
300-
return workflow
301-
302-
303252
def _pop(in_files):
304253
if isinstance(in_files, (list, tuple)):
305254
return in_files[0]

0 commit comments

Comments
 (0)