Skip to content

Commit 234c555

Browse files
committed
enh+sty: autotest and styling
1 parent 4f49bf4 commit 234c555

File tree

2 files changed

+102
-41
lines changed

2 files changed

+102
-41
lines changed

nipype/interfaces/c3.py

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -63,63 +63,63 @@ class C3dAffineTool(SEMLikeCommandLine):
6363

6464
class C3dInputSpec(CommandLineInputSpec):
6565
in_file = InputMultiPath(File(),
66-
position=1,
67-
argstr="%s",
68-
mandatory=True,
69-
desc="Input file (wildcard and multiple are supported)")
66+
position=1,
67+
argstr="%s",
68+
mandatory=True,
69+
desc="Input file (wildcard and multiple are supported)")
7070
out_file = File(exists=False,
71-
argstr="-o %s",
72-
position=-1,
73-
xor=["out_files"],
74-
desc="Output file of last image on the stack")
71+
argstr="-o %s",
72+
position=-1,
73+
xor=["out_files"],
74+
desc="Output file of last image on the stack")
7575
out_files = InputMultiPath(File(),
76-
argstr="-oo %s",
77-
xor=["out_file"],
78-
position=-1,
79-
desc=("Write all images on the convert3d stack as multiple files."
80-
" Supports both list of output files or a pattern for the output"
81-
" filenames (using %d substituion)."))
76+
argstr="-oo %s",
77+
xor=["out_file"],
78+
position=-1,
79+
desc=("Write all images on the convert3d stack as multiple files."
80+
" Supports both list of output files or a pattern for the output"
81+
" filenames (using %d substituion)."))
8282
pix_type = traits.Enum("float", "char", "uchar", "short", "ushort", "int", "uint", "double",
83-
argstr="-type %s",
84-
desc=("Specifies the pixel type for the output image. By default, images are written in"
85-
" floating point (float) format"))
83+
argstr="-type %s",
84+
desc=("Specifies the pixel type for the output image. By default, images are written in"
85+
" floating point (float) format"))
8686
scale = traits.Either(traits.Int(), traits.Float(),
87-
argstr="-scale %s",
88-
desc="Multiplies the intensity of each voxel in the last image on the stack by the given factor.")
87+
argstr="-scale %s",
88+
desc="Multiplies the intensity of each voxel in the last image on the stack by the given factor.")
8989
shift = traits.Either(traits.Int(), traits.Float(),
90-
argstr="-shift %s",
91-
desc='Adds the given constant to every voxel.')
90+
argstr="-shift %s",
91+
desc='Adds the given constant to every voxel.')
9292
interp = traits.Enum("Linear", "NearestNeighbor", "Cubic", "Sinc", "Gaussian",
93-
argstr="-interpolation %s",
94-
desc="Specifies the interpolation used with -resample and other commands. Default is Linear.")
93+
argstr="-interpolation %s",
94+
desc="Specifies the interpolation used with -resample and other commands. Default is Linear.")
9595
resample = traits.Str(argstr="-resample %s",
96-
desc=("Resamples the image, keeping the bounding box the same, but changing the number of"
97-
" voxels in the image. The dimensions can be specified as a percentage, for example to"
98-
" double the number of voxels in each direction. The -interpolation flag affects how"
99-
" sampling is performed."))
96+
desc=("Resamples the image, keeping the bounding box the same, but changing the number of"
97+
" voxels in the image. The dimensions can be specified as a percentage, for example to"
98+
" double the number of voxels in each direction. The -interpolation flag affects how"
99+
" sampling is performed."))
100100
smooth = traits.Str(argstr="-smooth %s",
101-
desc=("Applies Gaussian smoothing to the image. The parameter vector specifies the"
102-
" standard deviation of the Gaussian kernel."))
101+
desc=("Applies Gaussian smoothing to the image. The parameter vector specifies the"
102+
" standard deviation of the Gaussian kernel."))
103103
multicomp_split = traits.Bool(False,
104-
usedefault=True,
105-
argstr="-mcr",
106-
position=0,
107-
desc="Enable reading of multi-component images.")
108-
is_4d = traits.Bool(False,
109-
usedefault=True,
110-
desc="Changes command to support 4D file operations (default is false).")
104+
usedefault=True,
105+
argstr="-mcr",
106+
position=0,
107+
desc="Enable reading of multi-component images.")
108+
is_4d = traits.Bool(False,
109+
usedefault=True,
110+
desc="Changes command to support 4D file operations (default is false).")
111111

112112
class C3dOutputSpec(TraitedSpec):
113113
out_files = OutputMultiPath(File(exists=False))
114114

115115
class C3d(CommandLine):
116116
"""
117-
Convert3d is a command-line tool for converting 3D (or 4D) images between common
118-
file formats. The tool also includes a growing list of commands for image manipulation,
119-
such as thresholding and resampling. The tool can also be used to obtain information about
117+
Convert3d is a command-line tool for converting 3D (or 4D) images between common
118+
file formats. The tool also includes a growing list of commands for image manipulation,
119+
such as thresholding and resampling. The tool can also be used to obtain information about
120120
image files. More information on Convert3d can be found at:
121121
https://sourceforge.net/p/c3d/git/ci/master/tree/doc/c3d.md
122-
122+
123123
124124
Example
125125
=======
@@ -174,7 +174,7 @@ def _list_outputs(self):
174174
if isdefined(self.inputs.out_file):
175175
outputs["out_files"] = os.path.abspath(self.inputs.out_file)
176176
if isdefined(self.inputs.out_files):
177-
if not len(self.inputs.out_files) > 1:
177+
if len(self.inputs.out_files) == 1:
178178
_out_files = glob(os.path.abspath(self.inputs.out_files[0]))
179179
else:
180180
_out_files = [os.path.abspath(fl) for fl in self.inputs.out_files
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from __future__ import unicode_literals
3+
from ..c3 import C3d
4+
5+
6+
def test_C3d_inputs():
7+
input_map = dict(
8+
args=dict(argstr='%s', ),
9+
environ=dict(
10+
nohash=True,
11+
usedefault=True,
12+
),
13+
ignore_exception=dict(
14+
deprecated='1.0.0',
15+
nohash=True,
16+
usedefault=True,
17+
),
18+
in_file=dict(
19+
argstr='%s',
20+
mandatory=True,
21+
position=1,
22+
),
23+
interp=dict(argstr='-interpolation %s', ),
24+
is_4d=dict(usedefault=True, ),
25+
multicomp_split=dict(
26+
argstr='-mcr',
27+
position=0,
28+
usedefault=True,
29+
),
30+
out_file=dict(
31+
argstr='-o %s',
32+
position=-1,
33+
xor=['out_files'],
34+
),
35+
out_files=dict(
36+
argstr='-oo %s',
37+
position=-1,
38+
xor=['out_file'],
39+
),
40+
pix_type=dict(argstr='-type %s', ),
41+
resample=dict(argstr='-resample %s', ),
42+
scale=dict(argstr='-scale %s', ),
43+
shift=dict(argstr='-shift %s', ),
44+
smooth=dict(argstr='-smooth %s', ),
45+
terminal_output=dict(
46+
deprecated='1.0.0',
47+
nohash=True,
48+
),
49+
)
50+
inputs = C3d.input_spec()
51+
52+
for key, metadata in list(input_map.items()):
53+
for metakey, value in list(metadata.items()):
54+
assert getattr(inputs.traits()[key], metakey) == value
55+
def test_C3d_outputs():
56+
output_map = dict(out_files=dict(), )
57+
outputs = C3d.output_spec()
58+
59+
for key, metadata in list(output_map.items()):
60+
for metakey, value in list(metadata.items()):
61+
assert getattr(outputs.traits()[key], metakey) == value

0 commit comments

Comments
 (0)