Skip to content

Commit 0836459

Browse files
committed
Merge pull request #1 from satra/fix/eddy
a workflow fix, auto tests and some PEP8 changes
2 parents bfddda1 + 480d7f1 commit 0836459

File tree

4 files changed

+94
-58
lines changed

4 files changed

+94
-58
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -305,35 +305,60 @@ def _list_outputs(self):
305305

306306

307307
class EddyInputSpec( FSLCommandInputSpec ):
308-
in_file = File(exists=True, mandatory=True, desc='File containing all the images to estimate distortions for', argstr='--imain=%s' )
309-
in_mask = File(exists=True, mandatory=True, desc='Mask to indicate brain', argstr='--mask=%s' )
310-
in_index = File(exists=True, mandatory=True, desc='File containing indices for all volumes in --imain into --acqp and --topup', argstr='--index=%s' )
311-
in_acqp = File(exists=True, mandatory=True, desc='File containing acquisition parameters', argstr='--acqp=%s' )
312-
in_bvec = File(exists=True, mandatory=True, desc='File containing the b-vectors for all volumes in --imain', argstr='--bvecs=%s' )
313-
in_bval = File(exists=True, mandatory=True, desc='File containing the b-values for all volumes in --imain', argstr='--bvals=%s' )
314-
315-
out_base = File( desc='basename for output (warped) image', argstr='--out=%s' )
316-
317-
318-
session = File(exists=True, desc='File containing session indices for all volumes in --imain', argstr='--session=%s' )
319-
in_topup_fieldcoef = File(exists=True, argstr="--topup=%s", requires=['in_topup_movpar'],
320-
desc='topup file containing the field coefficients')
308+
in_file = File(exists=True, mandatory=True,
309+
desc=('File containing all the images to estimate '
310+
'distortions for'), argstr='--imain=%s')
311+
in_mask = File(exists=True, mandatory=True,
312+
desc='Mask to indicate brain', argstr='--mask=%s')
313+
in_index = File(exists=True, mandatory=True,
314+
desc=('File containing indices for all volumes in --imain '
315+
'into --acqp and --topup'), argstr='--index=%s')
316+
in_acqp = File(exists=True, mandatory=True,
317+
desc='File containing acquisition parameters',
318+
argstr='--acqp=%s' )
319+
in_bvec = File(exists=True, mandatory=True,
320+
desc=('File containing the b-vectors for all volumes in '
321+
'--imain'), argstr='--bvecs=%s')
322+
in_bval = File(exists=True, mandatory=True,
323+
desc=('File containing the b-values for all volumes in '
324+
'--imain'), argstr='--bvals=%s')
325+
out_base = File( desc='basename for output (warped) image',
326+
argstr='--out=%s' )
327+
session = File(exists=True,
328+
desc=('File containing session indices for all volumes in '
329+
'--imain'), argstr='--session=%s')
330+
in_topup_fieldcoef = File(exists=True, argstr="--topup=%s", copyfile=False,
331+
requires=['in_topup_movpar'],
332+
desc=('topup file containing the field '
333+
'coefficients'))
321334
in_topup_movpar = File(exists=True, requires=['in_topup_fieldcoef'],
322-
desc='topup movpar.txt file' )
323-
flm = traits.Enum( ('linear','quadratic','cubic'), desc='First level EC model', argstr='--flm=%s' )
324-
fwhm = traits.Float( desc='FWHM for conditioning filter when estimating the parameters', argstr='--fwhm=%s' )
325-
niter = traits.Int( 5, desc='Number of iterations', argstr='--niter=%s' )
326-
method = traits.Enum( ('jac','lsr'), argstr='--resamp=%s', desc='Final resampling method (jacobian/least squeares)' )
327-
repol = traits.Bool( False, desc='Detect and replace outlier slices', argstr='--repol' )
335+
copyfile=False, desc='topup movpar.txt file')
336+
flm = traits.Enum(('linear','quadratic','cubic'),
337+
desc='First level EC model', argstr='--flm=%s' )
338+
fwhm = traits.Float(desc=('FWHM for conditioning filter when estimating '
339+
'the parameters'), argstr='--fwhm=%s')
340+
niter = traits.Int( 5, desc='Number of iterations', argstr='--niter=%s')
341+
method = traits.Enum(('jac','lsr'), argstr='--resamp=%s',
342+
desc=('Final resampling method (jacobian/least '
343+
'squeares)'))
344+
repol = traits.Bool( False, desc='Detect and replace outlier slices',
345+
argstr='--repol' )
346+
328347

329348
class EddyOutputSpec( TraitedSpec ):
330-
out_corrected = File( exists=True, desc='4D image file containing all the corrected volumes' )
331-
out_parameter = File( exists=True, desc='text file with parameters definining the field and movement for each scan')
349+
out_corrected = File(exists=True,
350+
desc=('4D image file containing all the corrected '
351+
'volumes'))
352+
out_parameter = File(exists=True,
353+
desc=('text file with parameters definining the field '
354+
'and movement for each scan'))
332355

333356
class Eddy( FSLCommand ):
334-
""" Interface for FSL eddy, a tool for estimating and correcting eddy currents induced distortions.
335-
`User guide <http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Eddy/UsersGuide>`_ and
336-
`more info regarding acqp file <http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy/Faq#How_do_I_know_what_to_put_into_my_--acqp_file>`_.
357+
""" Interface for FSL eddy, a tool for estimating and correcting eddy
358+
currents induced distortions. `User guide
359+
<http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Eddy/UsersGuide>`_ and
360+
`more info regarding acqp file
361+
<http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy/Faq#How_do_I_know_what_to_put_into_my_--acqp_file>`_.
337362
338363
Examples
339364
--------

nipype/interfaces/fsl/tests/test_auto_Eddy.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ def test_Eddy_inputs():
3333
in_mask=dict(argstr='--mask=%s',
3434
mandatory=True,
3535
),
36-
in_topup=dict(argstr='--topup=%s',
36+
in_topup_fieldcoef=dict(argstr='--topup=%s',
37+
copyfile=False,
38+
requires=['in_topup_movpar'],
39+
),
40+
in_topup_movpar=dict(copyfile=False,
41+
requires=['in_topup_fieldcoef'],
3742
),
3843
method=dict(argstr='--resamp=%s',
3944
),
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
11
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
22
from nipype.testing import assert_equal
33
from nipype.interfaces.vista.vista import Vnifti2Image
4+
45
def test_Vnifti2Image_inputs():
5-
input_map = dict(ignore_exception=dict(nohash=True,
6-
usedefault=True,
7-
),
8-
out_file=dict(hash_files=False,
9-
name_template='%s.v',
10-
name_source=['in_file'],
11-
keep_extension=False,
12-
position=-1,
13-
argstr='-out %s',
14-
),
15-
args=dict(argstr='%s',
6+
input_map = dict(args=dict(argstr='%s',
167
),
17-
terminal_output=dict(nohash=True,
18-
mandatory=True,
8+
attributes=dict(argstr='-attr %s',
9+
mandatory=False,
10+
position=2,
1911
),
2012
environ=dict(nohash=True,
2113
usedefault=True,
2214
),
23-
in_file=dict(position=1,
15+
ignore_exception=dict(nohash=True,
16+
usedefault=True,
17+
),
18+
in_file=dict(argstr='-in %s',
2419
mandatory=True,
25-
argstr='-in %s',
20+
position=1,
2621
),
27-
attributes=dict(position=2,
28-
mandatory=False,
29-
argstr='-attr %s',
22+
out_file=dict(argstr='-out %s',
23+
hash_files=False,
24+
keep_extension=False,
25+
name_source=['in_file'],
26+
name_template='%s.v',
27+
position=-1,
28+
),
29+
terminal_output=dict(mandatory=True,
30+
nohash=True,
3031
),
3132
)
3233
inputs = Vnifti2Image.input_spec()
3334

3435
for key, metadata in input_map.items():
3536
for metakey, value in metadata.items():
3637
yield assert_equal, getattr(inputs.traits()[key], metakey), value
38+
3739
def test_Vnifti2Image_outputs():
3840
output_map = dict(out_file=dict(),
3941
)
@@ -42,3 +44,4 @@ def test_Vnifti2Image_outputs():
4244
for key, metadata in output_map.items():
4345
for metakey, value in metadata.items():
4446
yield assert_equal, getattr(outputs.traits()[key], metakey), value
47+
Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
22
from nipype.testing import assert_equal
33
from nipype.interfaces.vista.vista import VtoMat
4+
45
def test_VtoMat_inputs():
5-
input_map = dict(ignore_exception=dict(nohash=True,
6-
usedefault=True,
6+
input_map = dict(args=dict(argstr='%s',
77
),
8-
out_file=dict(hash_files=False,
9-
name_template='%s.mat',
10-
name_source=['in_file'],
11-
keep_extension=False,
12-
position=-1,
13-
argstr='-out %s',
8+
environ=dict(nohash=True,
9+
usedefault=True,
1410
),
15-
args=dict(argstr='%s',
11+
ignore_exception=dict(nohash=True,
12+
usedefault=True,
1613
),
17-
terminal_output=dict(nohash=True,
14+
in_file=dict(argstr='-in %s',
1815
mandatory=True,
16+
position=1,
1917
),
20-
environ=dict(nohash=True,
21-
usedefault=True,
18+
out_file=dict(argstr='-out %s',
19+
hash_files=False,
20+
keep_extension=False,
21+
name_source=['in_file'],
22+
name_template='%s.mat',
23+
position=-1,
2224
),
23-
in_file=dict(position=1,
24-
mandatory=True,
25-
argstr='-in %s',
25+
terminal_output=dict(mandatory=True,
26+
nohash=True,
2627
),
2728
)
2829
inputs = VtoMat.input_spec()
2930

3031
for key, metadata in input_map.items():
3132
for metakey, value in metadata.items():
3233
yield assert_equal, getattr(inputs.traits()[key], metakey), value
34+
3335
def test_VtoMat_outputs():
3436
output_map = dict(out_file=dict(),
3537
)
@@ -38,3 +40,4 @@ def test_VtoMat_outputs():
3840
for key, metadata in output_map.items():
3941
for metakey, value in metadata.items():
4042
yield assert_equal, getattr(outputs.traits()[key], metakey), value
43+

0 commit comments

Comments
 (0)