Skip to content

FIX: Remove 'reg_term'/'regularisation' from dwi2tensor interface #2731

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 2 commits into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions nipype/interfaces/mrtrix3/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,39 @@
from __future__ import (print_function, division, unicode_literals,
absolute_import)

from ... import logging
from ..base import (CommandLineInputSpec, CommandLine, traits, File, isdefined)
from ... import logging, LooseVersion
from ...utils.filemanip import which
from ..base import (CommandLineInputSpec, CommandLine, traits, File, isdefined, PackageInfo)
iflogger = logging.getLogger('nipype.interface')


class Info(PackageInfo):
version_cmd = 'mrconvert --version'

@staticmethod
def parse_version(raw_info):
# info is like: "== mrconvert 0.3.15-githash"
for line in raw_info.splitlines():
if line.startswith('== mrconvert '):
v_string = line.split()[2]
break
else:
return None

# -githash may or may not be appended
v_string = v_string.split('-')[0]

return '.'.join(v_string.split('.')[:3])

@classmethod
def looseversion(cls):
""" Return a comparable version object

If no version found, use LooseVersion('0.0.0')
"""
return LooseVersion(cls.version() or '0.0.0')


class MRTrix3BaseInputSpec(CommandLineInputSpec):
nthreads = traits.Int(
argstr='-nthreads %d',
Expand Down Expand Up @@ -78,3 +106,7 @@ def _parse_inputs(self, skip=None):
pass

return super(MRTrix3Base, self)._parse_inputs(skip=skip)

@property
def version(self):
return Info.version()
5 changes: 2 additions & 3 deletions nipype/interfaces/mrtrix3/reconst.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class FitTensorInputSpec(MRTrix3BaseInputSpec):
argstr='-method %s',
desc=('select method used to perform the fitting'))
reg_term = traits.Float(
5.e3, usedefault=True,
argstr='-regularisation %f',
max_ver='0.3.13',
desc=('specify the strength of the regularisation term on the '
'magnitude of the tensor elements (default = 5000). This '
'only applies to the non-linear methods'))
Expand All @@ -64,8 +64,7 @@ class FitTensor(MRTrix3Base):
>>> tsr.inputs.in_mask = 'mask.nii.gz'
>>> tsr.inputs.grad_fsl = ('bvecs', 'bvals')
>>> tsr.cmdline # doctest: +ELLIPSIS
'dwi2tensor -fslgrad bvecs bvals -mask mask.nii.gz \
-regularisation 5000.000000 dwi.mif dti.mif'
'dwi2tensor -fslgrad bvecs bvals -mask mask.nii.gz dwi.mif dti.mif'
>>> tsr.run() # doctest: +SKIP
"""

Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/mrtrix3/tests/test_auto_FitTensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_FitTensor_inputs():
),
reg_term=dict(
argstr='-regularisation %f',
usedefault=True,
max_ver='0.3.13',
),
)
inputs = FitTensor.input_spec()
Expand Down