@@ -23,13 +23,16 @@ class MathsInput(FSLCommandInputSpec):
2323
2424 in_file = File (position = 2 , argstr = "%s" , exists = True , mandatory = True ,
2525 desc = "image to operate on" )
26- out_file = File (genfile = True , position = - 2 , argstr = "%s" , desc = "image to write" , hash_files = False )
26+ out_file = File (genfile = True , position = - 2 , argstr = "%s" ,
27+ desc = "image to write" , hash_files = False )
2728 _dtypes = ["float" , "char" , "int" , "short" , "double" , "input" ]
2829 internal_datatype = traits .Enum (* _dtypes , position = 1 , argstr = "-dt %s" ,
29- desc = "datatype to use for calculations (default is float)" )
30+ desc = ("datatype to use for calculations "
31+ "(default is float)" ))
3032 output_datatype = traits .Enum (* _dtypes ,
3133 position = - 1 , argstr = "-odt %s" ,
32- desc = "datatype to use for output (default uses input type)" )
34+ desc = ("datatype to use for output (default "
35+ "uses input type)" ))
3336
3437 nan2zeros = traits .Bool (position = 3 , argstr = '-nan' ,
3538 desc = 'change NaNs to zeros before doing anything' )
@@ -51,7 +54,8 @@ def _list_outputs(self):
5154 outputs = self .output_spec ().get ()
5255 outputs ["out_file" ] = self .inputs .out_file
5356 if not isdefined (self .inputs .out_file ):
54- outputs ["out_file" ] = self ._gen_fname (self .inputs .in_file , suffix = self ._suffix )
57+ outputs ["out_file" ] = self ._gen_fname (self .inputs .in_file ,
58+ suffix = self ._suffix )
5559 outputs ["out_file" ] = os .path .abspath (outputs ["out_file" ])
5660 return outputs
5761
@@ -65,7 +69,8 @@ class ChangeDataTypeInput(MathsInput):
6569
6670 _dtypes = ["float" , "char" , "int" , "short" , "double" , "input" ]
6771 output_datatype = traits .Enum (* _dtypes ,
68- position = - 1 , argstr = "-odt %s" , mandatory = True ,
72+ position = - 1 , argstr = "-odt %s" ,
73+ mandatory = True ,
6974 desc = "output data type" )
7075
7176
@@ -83,9 +88,11 @@ class ThresholdInputSpec(MathsInput):
8388 desc = "threshold value" )
8489 direction = traits .Enum ("below" , "above" , usedefault = True ,
8590 desc = "zero-out either below or above thresh value" )
86- use_robust_range = traits .Bool (desc = "interpret thresh as percentage (0-100) of robust range" )
87- use_nonzero_voxels = traits .Bool (desc = "use nonzero voxels to calculate robust range" ,
88- requires = ["use_robust_range" ])
91+ use_robust_range = traits .Bool (
92+ desc = "interpret thresh as percentage (0-100) of robust range" )
93+ use_nonzero_voxels = traits .Bool (
94+ desc = "use nonzero voxels to calculate robust range" ,
95+ requires = ["use_robust_range" ])
8996
9097
9198class Threshold (MathsCommand ):
@@ -103,29 +110,35 @@ def _format_arg(self, name, spec, value):
103110 arg += "u"
104111 arg += "thr"
105112 if isdefined (_si .use_robust_range ) and _si .use_robust_range :
106- if isdefined (_si .use_nonzero_voxels ) and _si .use_nonzero_voxels :
113+ if (isdefined (_si .use_nonzero_voxels ) and
114+ _si .use_nonzero_voxels ):
107115 arg += "P"
108116 else :
109117 arg += "p"
110118 arg += " %.10f" % value
111119 return arg
112120 return super (Threshold , self )._format_arg (name , spec , value )
113121
122+
114123class StdImageInput (MathsInput ):
115124
116- dimension = traits .Enum ("T" , "X" , "Y" , "Z" , usedefault = True , argstr = "-%sstd" , position = 4 ,
125+ dimension = traits .Enum ("T" , "X" , "Y" , "Z" , usedefault = True ,
126+ argstr = "-%sstd" , position = 4 ,
117127 desc = "dimension to standard deviate across" )
118128
119129
120130class StdImage (MathsCommand ):
121- """Use fslmaths to generate a standard deviation in an image across a given dimension.
131+ """Use fslmaths to generate a standard deviation in an image across a given
132+ dimension.
122133 """
123134 input_spec = StdImageInput
124135 _suffix = "_std"
125136
137+
126138class MeanImageInput (MathsInput ):
127139
128- dimension = traits .Enum ("T" , "X" , "Y" , "Z" , usedefault = True , argstr = "-%smean" , position = 4 ,
140+ dimension = traits .Enum ("T" , "X" , "Y" , "Z" , usedefault = True ,
141+ argstr = "-%smean" , position = 4 ,
129142 desc = "dimension to mean across" )
130143
131144
@@ -139,7 +152,8 @@ class MeanImage(MathsCommand):
139152
140153class MaxImageInput (MathsInput ):
141154
142- dimension = traits .Enum ("T" , "X" , "Y" , "Z" , usedefault = True , argstr = "-%smax" , position = 4 ,
155+ dimension = traits .Enum ("T" , "X" , "Y" , "Z" , usedefault = True ,
156+ argstr = "-%smax" , position = 4 ,
143157 desc = "dimension to max across" )
144158
145159
@@ -162,9 +176,11 @@ class MaxImage(MathsCommand):
162176
163177class IsotropicSmoothInput (MathsInput ):
164178
165- fwhm = traits .Float (mandatory = True , xor = ["sigma" ], position = 4 , argstr = "-s %.5f" ,
179+ fwhm = traits .Float (mandatory = True , xor = ["sigma" ],
180+ position = 4 , argstr = "-s %.5f" ,
166181 desc = "fwhm of smoothing kernel [mm]" )
167- sigma = traits .Float (mandatory = True , xor = ["fwhm" ], position = 4 , argstr = "-s %.5f" ,
182+ sigma = traits .Float (mandatory = True , xor = ["fwhm" ],
183+ position = 4 , argstr = "-s %.5f" ,
168184 desc = "sigma of smoothing kernel [mm]" )
169185
170186
@@ -198,17 +214,22 @@ class ApplyMask(MathsCommand):
198214
199215class KernelInput (MathsInput ):
200216
201- kernel_shape = traits .Enum ("3D" , "2D" , "box" , "boxv" , "gauss" , "sphere" , "file" ,
202- argstr = "-kernel %s" , position = 4 , desc = "kernel shape to use" )
217+ kernel_shape = traits .Enum ("3D" , "2D" , "box" , "boxv" , "gauss" , "sphere" ,
218+ "file" ,
219+ argstr = "-kernel %s" , position = 4 ,
220+ desc = "kernel shape to use" )
203221 kernel_size = traits .Float (argstr = "%.4f" , position = 5 , xor = ["kernel_file" ],
204- desc = "kernel size - voxels for box/boxv, mm for sphere, mm sigma for gauss" )
205- kernel_file = File (exists = True , argstr = "%s" , position = 5 , xor = ["kernel_size" ],
222+ desc = ("kernel size - voxels for box/boxv, mm "
223+ "for sphere, mm sigma for gauss" ))
224+ kernel_file = File (exists = True , argstr = "%s" , position = 5 ,
225+ xor = ["kernel_size" ],
206226 desc = "use external file for kernel" )
207227
208228
209229class DilateInput (KernelInput ):
210230
211- operation = traits .Enum ("mean" , "modal" , "max" , argstr = "-dil%s" , position = 6 , mandatory = True ,
231+ operation = traits .Enum ("mean" , "modal" , "max" , argstr = "-dil%s" ,
232+ position = 6 , mandatory = True ,
212233 desc = "filtering operation to perfoem in dilation" )
213234
214235
@@ -227,8 +248,10 @@ def _format_arg(self, name, spec, value):
227248
228249class ErodeInput (KernelInput ):
229250
230- minimum_filter = traits .Bool (argstr = "%s" , position = 6 , usedefault = True , default_value = False ,
231- desc = "if true, minimum filter rather than erosion by zeroing-out" )
251+ minimum_filter = traits .Bool (argstr = "%s" , position = 6 , usedefault = True ,
252+ default_value = False ,
253+ desc = ("if true, minimum filter rather than "
254+ "erosion by zeroing-out" ))
232255
233256
234257class ErodeImage (MathsCommand ):
@@ -248,7 +271,8 @@ def _format_arg(self, name, spec, value):
248271
249272class SpatialFilterInput (KernelInput ):
250273
251- operation = traits .Enum ("mean" , "median" , "meanu" , argstr = "-f%s" , position = 6 , mandatory = True ,
274+ operation = traits .Enum ("mean" , "median" , "meanu" , argstr = "-f%s" ,
275+ position = 6 , mandatory = True ,
252276 desc = "operation to filter with" )
253277
254278
@@ -262,8 +286,9 @@ class SpatialFilter(MathsCommand):
262286
263287class UnaryMathsInput (MathsInput ):
264288
265- operation = traits .Enum ("exp" , "log" , "sin" , "cos" , "tan" , "asin" , "acos" , "atan" , "sqr" , "sqrt" ,
266- "recip" , "abs" , "bin" , "binv" , "fillh" , "fillh26" , "index" , "edge" , "nan" ,
289+ operation = traits .Enum ("exp" , "log" , "sin" , "cos" , "tan" , "asin" , "acos" ,
290+ "atan" , "sqr" , "sqrt" , "recip" , "abs" , "bin" ,
291+ "binv" , "fillh" , "fillh26" , "index" , "edge" , "nan" ,
267292 "nanm" , "rand" , "randn" , "range" ,
268293 argstr = "-%s" , position = 4 , mandatory = True ,
269294 desc = "operation to perform" )
@@ -285,14 +310,17 @@ class BinaryMathsInput(MathsInput):
285310 operation = traits .Enum ("add" , "sub" , "mul" , "div" , "rem" , "max" , "min" ,
286311 mandatory = True , argstr = "-%s" , position = 4 ,
287312 desc = "operation to perform" )
288- operand_file = File (exists = True , argstr = "%s" , mandatory = True , position = 5 , xor = ["operand_value" ],
313+ operand_file = File (exists = True , argstr = "%s" , mandatory = True ,
314+ position = 5 , xor = ["operand_value" ],
289315 desc = "second image to perform operation with" )
290- operand_value = traits .Float (argstr = "%.8f" , mandatory = True , position = 5 , xor = ["operand_file" ],
316+ operand_value = traits .Float (argstr = "%.8f" , mandatory = True ,
317+ position = 5 , xor = ["operand_file" ],
291318 desc = "value to perform operation with" )
292319
293320
294321class BinaryMaths (MathsCommand ):
295- """Use fslmaths to perform mathematical operations using a second image or a numeric value.
322+ """Use fslmaths to perform mathematical operations using a second image or
323+ a numeric value.
296324
297325 """
298326 input_spec = BinaryMathsInput
@@ -301,9 +329,11 @@ class BinaryMaths(MathsCommand):
301329class MultiImageMathsInput (MathsInput ):
302330
303331 op_string = traits .String (position = 4 , argstr = "%s" , mandatory = True ,
304- desc = "python formatted string of operations to perform" )
332+ desc = ("python formatted string of operations "
333+ "to perform" ))
305334 operand_files = InputMultiPath (File (exists = True ), mandatory = True ,
306- desc = "list of file names to plug into op string" )
335+ desc = ("list of file names to plug into op "
336+ "string" ))
307337
308338
309339class MultiImageMaths (MathsCommand ):
@@ -331,14 +361,17 @@ def _format_arg(self, name, spec, value):
331361
332362class TemporalFilterInput (MathsInput ):
333363
334- lowpass_sigma = traits .Float (- 1 , argstr = "%.6f" , position = 5 , usedefault = True ,
364+ lowpass_sigma = traits .Float (- 1 , argstr = "%.6f" , position = 5 ,
365+ usedefault = True ,
335366 desc = "lowpass filter sigma (in volumes)" )
336- highpass_sigma = traits .Float (- 1 , argstr = "-bptf %.6f" , position = 4 , usedefault = True ,
367+ highpass_sigma = traits .Float (- 1 , argstr = "-bptf %.6f" , position = 4 ,
368+ usedefault = True ,
337369 desc = "highpass filter sigma (in volumes)" )
338370
339371
340372class TemporalFilter (MathsCommand ):
341- """Use fslmaths to apply a low, high, or bandpass temporal filter to a timeseries.
373+ """Use fslmaths to apply a low, high, or bandpass temporal filter to a
374+ timeseries.
342375
343376 """
344377 input_spec = TemporalFilterInput
0 commit comments