Skip to content

Commit 5292c7b

Browse files
authored
Merge pull request #472 from eilidhmacnicol/fix/fast_bias_iters
FIX: set fast bias_iters parameter to 0
2 parents 46ba744 + 401cc22 commit 5292c7b

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

src/smriprep/interfaces/fsl.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from nipype.interfaces.base import traits
2+
from nipype.interfaces.fsl.preprocess import FAST as _FAST
3+
from nipype.interfaces.fsl.preprocess import FASTInputSpec
4+
5+
6+
class _FixTraitFASTInputSpec(FASTInputSpec):
7+
bias_iters = traits.Range(
8+
low=0,
9+
high=10,
10+
argstr='-I %d',
11+
desc='number of main-loop iterations during bias-field removal',
12+
)
13+
14+
15+
class FAST(_FAST):
16+
"""
17+
A replacement for nipype.interfaces.fsl.preprocess.FAST that allows
18+
`bias_iters=0` to disable bias field correction entirely
19+
20+
>>> from smriprep.interfaces.fsl import FAST
21+
>>> fast = FAST()
22+
>>> fast.inputs.in_files = 'sub-01_desc-warped_T1w.nii.gz'
23+
>>> fast.inputs.bias_iters = 0
24+
>>> fast.cmdline
25+
'fast -I 0 -S 1 sub-01_desc-warped_T1w.nii.gz'
26+
"""
27+
28+
input_spec = _FixTraitFASTInputSpec

src/smriprep/workflows/anatomical.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import smriprep
5858

5959
from ..interfaces import DerivativesDataSink
60+
from ..interfaces.fsl import FAST
6061
from ..utils.misc import apply_lut as _apply_bids_lut
6162
from ..utils.misc import fs_isRunning as _fs_isRunning
6263
from .fit.registration import init_register_template_wf
@@ -947,14 +948,14 @@ def init_anat_fit_wf(
947948
# Stage 3: Segmentation
948949
if not (have_dseg and have_tpms):
949950
LOGGER.info('ANAT Stage 3: Preparing segmentation workflow')
950-
fsl_ver = fsl.FAST().version or '(version unknown)'
951+
fsl_ver = FAST().version or '(version unknown)'
951952
desc += f"""\
952953
Brain tissue segmentation of cerebrospinal fluid (CSF),
953954
white-matter (WM) and gray-matter (GM) was performed on
954955
the brain-extracted T1w using `fast` [FSL {fsl_ver}, RRID:SCR_002823, @fsl_fast].
955956
"""
956957
fast = pe.Node(
957-
fsl.FAST(segments=True, no_bias=True, probability_maps=True),
958+
FAST(segments=True, no_bias=True, probability_maps=True, bias_iters=0),
958959
name='fast',
959960
mem_gb=3,
960961
)

0 commit comments

Comments
 (0)