Skip to content

Commit 294a867

Browse files
committed
enh: add brainmask_thresh as a parameter
1 parent 2af5e71 commit 294a867

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

niworkflows/func/util.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
def init_bold_reference_wf(
3030
omp_nthreads,
3131
bold_file=None,
32+
brainmask_thresh=0.5,
3233
pre_mask=False,
3334
name="bold_reference_wf",
3435
gen_report=False,
@@ -50,10 +51,16 @@ def init_bold_reference_wf(
5051
5152
Parameters
5253
----------
53-
bold_file : str
54-
BOLD series NIfTI file
5554
omp_nthreads : int
5655
Maximum number of threads an individual process may use
56+
bold_file : str
57+
BOLD series NIfTI file
58+
brainmask_thresh: :obj:`float`
59+
Lower threshold for the probabilistic brainmask to obtain
60+
the final binary mask (default: 0.5).
61+
pre_mask : bool
62+
Indicates whether the ``pre_mask`` input will be set (and thus, step 1
63+
should be skipped).
5764
name : str
5865
Name of workflow (default: ``bold_reference_wf``)
5966
gen_report : bool
@@ -133,7 +140,9 @@ def init_bold_reference_wf(
133140
EstimateReferenceImage(), name="gen_ref", mem_gb=1
134141
) # OE: 128x128x128x50 * 64 / 8 ~ 900MB.
135142
enhance_and_skullstrip_bold_wf = init_enhance_and_skullstrip_bold_wf(
136-
omp_nthreads=omp_nthreads, pre_mask=pre_mask
143+
brainmask_thresh=brainmask_thresh,
144+
omp_nthreads=omp_nthreads,
145+
pre_mask=pre_mask,
137146
)
138147

139148
calc_dummy_scans = pe.Node(
@@ -188,7 +197,10 @@ def init_bold_reference_wf(
188197

189198

190199
def init_enhance_and_skullstrip_bold_wf(
191-
name="enhance_and_skullstrip_bold_wf", pre_mask=False, omp_nthreads=1
200+
brainmask_thresh=0.5,
201+
name="enhance_and_skullstrip_bold_wf",
202+
omp_nthreads=1,
203+
pre_mask=False,
192204
):
193205
"""
194206
Enhance and run brain extraction on a BOLD EPI image.
@@ -238,13 +250,16 @@ def init_enhance_and_skullstrip_bold_wf(
238250
239251
Parameters
240252
----------
253+
brainmask_thresh: :obj:`float`
254+
Lower threshold for the probabilistic brainmask to obtain
255+
the final binary mask (default: 0.5).
241256
name : str
242257
Name of workflow (default: ``enhance_and_skullstrip_bold_wf``)
258+
omp_nthreads : int
259+
number of threads available to parallel nodes
243260
pre_mask : bool
244261
Indicates whether the ``pre_mask`` input will be set (and thus, step 1
245262
should be skipped).
246-
omp_nthreads : int
247-
number of threads available to parallel nodes
248263
249264
Inputs
250265
------
@@ -399,7 +414,7 @@ def init_enhance_and_skullstrip_bold_wf(
399414
),
400415
name="map_brainmask",
401416
)
402-
binarize_mask = pe.Node(Binarize(thresh_low=0.15), name="binarize_mask")
417+
binarize_mask = pe.Node(Binarize(thresh_low=brainmask_thresh), name="binarize_mask")
403418

404419
# fmt: off
405420
workflow.connect([

0 commit comments

Comments
 (0)