Skip to content

FIX: Handle changes in CLI structure of mrtrix3.DWIBiasCorrect #3248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 8, 2020
4 changes: 4 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,10 @@
"affiliation": "Sagol School of Neuroscience, Tel Aviv University",
"name": "Baratz, Zvi"
},
{
"affiliation": "Sagol School of Neuroscience, Tel Aviv University",
"name": "Ben-Zvi, Gal"
},
{
"name": "Matsubara, K"
},
Expand Down
16 changes: 12 additions & 4 deletions nipype/interfaces/mrtrix3/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,17 @@ class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec):
)
in_mask = File(argstr="-mask %s", desc="input mask image for bias field estimation")
use_ants = traits.Bool(
argstr="-ants",
argstr="ants",
mandatory=True,
desc="use ANTS N4 to estimate the inhomogeneity field",
position=0,
xor=["use_fsl"],
)
use_fsl = traits.Bool(
argstr="-fsl",
argstr="fsl",
mandatory=True,
desc="use FSL FAST to estimate the inhomogeneity field",
position=0,
xor=["use_ants"],
)
bias = File(argstr="-bias %s", desc="bias field")
Expand Down Expand Up @@ -224,14 +226,20 @@ class DWIBiasCorrect(MRTrix3Base):
>>> bias_correct.inputs.in_file = 'dwi.mif'
>>> bias_correct.inputs.use_ants = True
>>> bias_correct.cmdline
'dwibiascorrect -ants dwi.mif dwi_biascorr.mif'
'dwibiascorrect ants dwi.mif dwi_biascorr.mif'
>>> bias_correct.run() # doctest: +SKIP
"""

_cmd = "dwibiascorrect"
input_spec = DWIBiasCorrectInputSpec
output_spec = DWIBiasCorrectOutputSpec

def _format_arg(self, name, trait_spec, value):
if name in ("use_ants", "use_fsl"):
ver = self.version
# Changed in version 3.0, after release candidates
if ver is not None and (ver[0] < "3" or ver.startswith("3.0_RC")):
return f"-{trait_spec.argstr}"
super()._format_arg(name, trait_spec, value)

class ResponseSDInputSpec(MRTrix3BaseInputSpec):
algorithm = traits.Enum(
Expand Down