Skip to content

Commit 432e0f6

Browse files
committed
add FSL bvec/bval format explicit to all interfaces
1 parent 9c5eadd commit 432e0f6

File tree

6 files changed

+39
-0
lines changed

6 files changed

+39
-0
lines changed

nipype/interfaces/mrtrix3/base.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ class MRTrix3BaseInputSpec(CommandLineInputSpec):
4444
'BValueScaling entry. Valid choices are yes / no, true / '
4545
'false, 0 / 1 (default: true).')
4646

47+
in_bvec = File(exists=True, argstr='-fslgrad %s %s',
48+
desc='bvecs file in FSL format')
49+
in_bval = File(exists=True, desc='bvals file in FSL format')
50+
4751

4852
class MRTrix3Base(CommandLine):
4953

@@ -58,4 +62,24 @@ def _format_arg(self, name, trait_spec, value):
5862
pass
5963
return trait_spec.argstr % value
6064

65+
if name == 'in_bvec':
66+
return trait_spec.argstr % (value, self.inputs.in_bval)
67+
6168
return super(MRTrix3Base, self)._format_arg(name, trait_spec, value)
69+
70+
def _parse_inputs(self, skip=None):
71+
if skip is None:
72+
skip = []
73+
if (isdefined(self.inputs.grad_file) or
74+
isdefined(self.inputs.grad_fsl)):
75+
skip += ['in_bvec', 'in_bval']
76+
77+
is_bvec = isdefined(self.inputs.in_bvec)
78+
is_bval = isdefined(self.inputs.in_bval)
79+
if is_bvec or is_bval:
80+
if not is_bvec or not is_bval:
81+
raise RuntimeError('If using bvecs and bvals inputs, both'
82+
'should be defined')
83+
skip += ['in_bval']
84+
85+
return super(MRTrix3Base, self)._parse_inputs(skip=skip)

nipype/interfaces/mrtrix3/tests/test_auto_BrainMask.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ def test_BrainMask_inputs():
1717
ignore_exception=dict(nohash=True,
1818
usedefault=True,
1919
),
20+
in_bval=dict(),
21+
in_bvec=dict(argstr='-fslgrad %s %s',
22+
),
2023
in_file=dict(argstr='%s',
2124
mandatory=True,
2225
position=-2,

nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ def test_EstimateFOD_inputs():
1717
ignore_exception=dict(nohash=True,
1818
usedefault=True,
1919
),
20+
in_bval=dict(),
21+
in_bvec=dict(argstr='-fslgrad %s %s',
22+
),
2023
in_dirs=dict(argstr='-directions %s',
2124
),
2225
in_file=dict(argstr='%s',

nipype/interfaces/mrtrix3/tests/test_auto_FitTensor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ def test_FitTensor_inputs():
1717
ignore_exception=dict(nohash=True,
1818
usedefault=True,
1919
),
20+
in_bval=dict(),
21+
in_bvec=dict(argstr='-fslgrad %s %s',
22+
),
2023
in_file=dict(argstr='%s',
2124
mandatory=True,
2225
position=-2,

nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def test_ResponseSD_inputs():
1919
ignore_exception=dict(nohash=True,
2020
usedefault=True,
2121
),
22+
in_bval=dict(),
23+
in_bvec=dict(argstr='-fslgrad %s %s',
24+
),
2225
in_file=dict(argstr='%s',
2326
mandatory=True,
2427
position=-2,

nipype/interfaces/mrtrix3/tests/test_auto_Tractography.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def test_Tractography_inputs():
3434
ignore_exception=dict(nohash=True,
3535
usedefault=True,
3636
),
37+
in_bval=dict(),
38+
in_bvec=dict(argstr='-fslgrad %s %s',
39+
),
3740
in_file=dict(argstr='%s',
3841
mandatory=True,
3942
position=-2,

0 commit comments

Comments
 (0)