@@ -58,9 +58,9 @@ class SliceTimingInputSpec(SPMCommandInputSpec):
58
58
59
59
60
60
class SliceTimingOutputSpec (TraitedSpec ):
61
- timecorrected_files = OutputMultiPath (traits . Either ( traits . List ( File ( exists = True )),
62
- File (exists = True )),
63
- desc = 'slice time corrected files' )
61
+ timecorrected_files = OutputMultiPath (
62
+ traits . Either ( traits . List ( File ( exists = True )), File (exists = True )),
63
+ desc = 'slice time corrected files' )
64
64
65
65
66
66
class SliceTiming (SPMCommand ):
@@ -237,7 +237,8 @@ def _list_outputs(self):
237
237
break
238
238
if self .inputs .jobtype == "estimate" :
239
239
outputs ['realigned_files' ] = self .inputs .in_files
240
- if self .inputs .jobtype == "estimate" or self .inputs .jobtype == "estwrite" :
240
+ if (self .inputs .jobtype == "estimate" or
241
+ self .inputs .jobtype == "estwrite" ):
241
242
outputs ['modified_in_files' ] = self .inputs .in_files
242
243
if self .inputs .jobtype == "write" or self .inputs .jobtype == "estwrite" :
243
244
if isinstance (self .inputs .in_files [0 ], list ):
@@ -246,20 +247,21 @@ def _list_outputs(self):
246
247
first_image = self .inputs .in_files [0 ]
247
248
248
249
if resliced_mean :
249
- outputs ['mean_image' ] = fname_presuffix (first_image , prefix = 'mean' )
250
+ outputs ['mean_image' ] = fname_presuffix (first_image ,
251
+ prefix = 'mean' )
250
252
251
253
if resliced_all :
252
254
outputs ['realigned_files' ] = []
253
255
for idx , imgf in enumerate (filename_to_list (self .inputs .in_files )):
254
256
realigned_run = []
255
257
if isinstance (imgf , list ):
256
258
for i , inner_imgf in enumerate (filename_to_list (imgf )):
257
- newfile = fname_presuffix (inner_imgf ,
258
- prefix = self .inputs .out_prefix )
259
+ newfile = fname_presuffix (
260
+ inner_imgf , prefix = self .inputs .out_prefix )
259
261
realigned_run .append (newfile )
260
262
else :
261
- realigned_run = fname_presuffix (imgf ,
262
- prefix = self .inputs .out_prefix )
263
+ realigned_run = fname_presuffix (
264
+ imgf , prefix = self .inputs .out_prefix )
263
265
outputs ['realigned_files' ].append (realigned_run )
264
266
return outputs
265
267
@@ -278,7 +280,8 @@ class CoregisterInputSpec(SPMCommandInputSpec):
278
280
copyfile = True )
279
281
cost_function = traits .Enum ('mi' , 'nmi' , 'ecc' , 'ncc' ,
280
282
field = 'eoptions.cost_fun' ,
281
- desc = """cost function, one of: 'mi' - Mutual Information,
283
+ desc = """cost function, one of:
284
+ 'mi' - Mutual Information,
282
285
'nmi' - Normalised Mutual Information,
283
286
'ecc' - Entropy Correlation Coefficient,
284
287
'ncc' - Normalised Cross Correlation""" )
@@ -290,10 +293,12 @@ class CoregisterInputSpec(SPMCommandInputSpec):
290
293
tolerance = traits .List (traits .Float (), field = 'eoptions.tol' ,
291
294
desc = 'acceptable tolerance for each of 12 params' )
292
295
write_interp = traits .Range (low = 0 , high = 7 , field = 'roptions.interp' ,
293
- desc = 'degree of b-spline used for interpolation' )
296
+ desc = ('degree of b-spline used for '
297
+ 'interpolation' ))
294
298
write_wrap = traits .List (traits .Int (), minlen = 3 , maxlen = 3 ,
295
299
field = 'roptions.wrap' ,
296
- desc = 'Check if interpolation should wrap in [x,y,z]' )
300
+ desc = ('Check if interpolation should wrap in '
301
+ '[x,y,z]' ))
297
302
write_mask = traits .Bool (field = 'roptions.mask' ,
298
303
desc = 'True/False mask output image' )
299
304
out_prefix = traits .String ('r' , field = 'roptions.prefix' , usedefault = True ,
@@ -331,7 +336,8 @@ class Coregister(SPMCommand):
331
336
def _format_arg (self , opt , spec , val ):
332
337
"""Convert input to appropriate format for spm
333
338
"""
334
- if opt == 'target' or (opt == 'source' and self .inputs .jobtype != "write" ):
339
+ if (opt == 'target' or
340
+ (opt == 'source' and self .inputs .jobtype != "write" )):
335
341
return scans_for_fnames (filename_to_list (val ),
336
342
keep4d = True )
337
343
if opt == 'apply_to_files' :
@@ -360,7 +366,8 @@ def _list_outputs(self):
360
366
if isdefined (self .inputs .apply_to_files ):
361
367
outputs ['coregistered_files' ] = self .inputs .apply_to_files
362
368
outputs ['coregistered_source' ] = self .inputs .source
363
- elif self .inputs .jobtype == "write" or self .inputs .jobtype == "estwrite" :
369
+ elif (self .inputs .jobtype == "write"
370
+ or self .inputs .jobtype == "estwrite" ):
364
371
if isdefined (self .inputs .apply_to_files ):
365
372
outputs ['coregistered_files' ] = []
366
373
for imgf in filename_to_list (self .inputs .apply_to_files ):
@@ -391,11 +398,14 @@ class NormalizeInputSpec(SPMCommandInputSpec):
391
398
copyfile = True )
392
399
parameter_file = File (field = 'subj.matname' , mandatory = True ,
393
400
xor = ['source' , 'template' ],
394
- desc = 'normalization parameter file*_sn.mat' , copyfile = False )
401
+ desc = 'normalization parameter file*_sn.mat' ,
402
+ copyfile = False )
395
403
source_weight = File (field = 'subj.wtsrc' ,
396
- desc = 'name of weighting image for source' , copyfile = False )
404
+ desc = 'name of weighting image for source' ,
405
+ copyfile = False )
397
406
template_weight = File (field = 'eoptions.weight' ,
398
- desc = 'name of weighting image for template' , copyfile = False )
407
+ desc = 'name of weighting image for template' ,
408
+ copyfile = False )
399
409
source_image_smoothing = traits .Float (field = 'eoptions.smosrc' ,
400
410
desc = 'source smoothing' )
401
411
template_image_smoothing = traits .Float (field = 'eoptions.smoref' ,
@@ -406,9 +416,13 @@ class NormalizeInputSpec(SPMCommandInputSpec):
406
416
DCT_period_cutoff = traits .Float (field = 'eoptions.cutoff' ,
407
417
desc = 'Cutoff of for DCT bases' )
408
418
nonlinear_iterations = traits .Int (field = 'eoptions.nits' ,
409
- desc = 'Number of iterations of nonlinear warping' )
419
+ desc = ('Number of iterations of '
420
+ 'nonlinear warping' ))
410
421
nonlinear_regularization = traits .Float (field = 'eoptions.reg' ,
411
- desc = 'the amount of the regularization for the nonlinear part of the normalization' )
422
+ desc = ('the amount of the '
423
+ 'regularization for the '
424
+ 'nonlinear part of the '
425
+ 'normalization' ))
412
426
write_preserve = traits .Bool (field = 'roptions.preserve' ,
413
427
desc = 'True/False warped images are modulated' )
414
428
write_bounding_box = traits .List (traits .List (traits .Float (), minlen = 3 ,
@@ -419,17 +433,20 @@ class NormalizeInputSpec(SPMCommandInputSpec):
419
433
minlen = 3 , maxlen = 3 ,
420
434
desc = '3-element list' )
421
435
write_interp = traits .Range (low = 0 , high = 7 , field = 'roptions.interp' ,
422
- desc = 'degree of b-spline used for interpolation' )
436
+ desc = ('degree of b-spline used for '
437
+ 'interpolation' ))
423
438
write_wrap = traits .List (traits .Int (), field = 'roptions.wrap' ,
424
- desc = ('Check if interpolation should wrap in [x,y,z] '
425
- '- list of bools' ))
439
+ desc = ('Check if interpolation should wrap in '
440
+ '[x,y,z] - list of bools' ))
426
441
out_prefix = traits .String ('w' , field = 'roptions.prefix' , usedefault = True ,
427
442
desc = 'normalized output prefix' )
428
443
429
444
430
445
class NormalizeOutputSpec (TraitedSpec ):
431
446
normalization_parameters = OutputMultiPath (File (exists = True ),
432
- desc = 'MAT files containing the normalization parameters' )
447
+ desc = ('MAT files containing '
448
+ 'the normalization '
449
+ 'parameters' ))
433
450
normalized_source = OutputMultiPath (File (exists = True ),
434
451
desc = 'Normalized source files' )
435
452
normalized_files = OutputMultiPath (File (exists = True ),
@@ -505,7 +522,8 @@ def _list_outputs(self):
505
522
outputs ['normalized_files' ] = self .inputs .apply_to_files
506
523
outputs ['normalized_source' ] = self .inputs .source
507
524
elif 'write' in self .inputs .jobtype :
508
- if isdefined (self .inputs .write_preserve ) and self .inputs .write_preserve :
525
+ if (isdefined (self .inputs .write_preserve )
526
+ and self .inputs .write_preserve ):
509
527
prefixNorm = '' .join (['m' , self .inputs .out_prefix ])
510
528
else :
511
529
prefixNorm = self .inputs .out_prefix
@@ -514,7 +532,8 @@ def _list_outputs(self):
514
532
filelist = filename_to_list (self .inputs .apply_to_files )
515
533
for f in filelist :
516
534
if isinstance (f , list ):
517
- run = [fname_presuffix (in_f , prefix = prefixNorm ) for in_f in f ]
535
+ run = [fname_presuffix (in_f , prefix = prefixNorm )
536
+ for in_f in f ]
518
537
else :
519
538
run = [fname_presuffix (f , prefix = prefixNorm )]
520
539
outputs ['normalized_files' ].extend (run )
@@ -529,7 +548,8 @@ def _list_outputs(self):
529
548
530
549
class Normalize12InputSpec (SPMCommandInputSpec ):
531
550
image_to_align = File (exists = True , field = 'subj.vol' ,
532
- desc = 'file to estimate normalization parameters with' ,
551
+ desc = ('file to estimate normalization parameters '
552
+ 'with' ),
533
553
xor = ['deformation_file' ],
534
554
mandatory = True , copyfile = True )
535
555
apply_to_files = InputMultiPath (traits .Either (File (exists = True ),
@@ -539,8 +559,9 @@ class Normalize12InputSpec(SPMCommandInputSpec):
539
559
copyfile = True )
540
560
deformation_file = File (field = 'subj.def' , mandatory = True ,
541
561
xor = ['image_to_align' , 'tpm' ],
542
- desc = ('file y_*.nii containing 3 deformation fields '
543
- 'for the deformation in x, y and z dimension' ),
562
+ desc = ('file y_*.nii containing 3 deformation '
563
+ 'fields for the deformation in x, y and z '
564
+ 'dimension' ),
544
565
copyfile = False )
545
566
jobtype = traits .Enum ('estwrite' , 'est' , 'write' , usedefault = True ,
546
567
desc = 'Estimate, Write or do Both' )
@@ -551,7 +572,8 @@ class Normalize12InputSpec(SPMCommandInputSpec):
551
572
140 , 150 , 'Inf' , field = 'eoptions.biasfwhm' ,
552
573
desc = 'FWHM of Gaussian smoothness of bias' )
553
574
tpm = File (exists = True , field = 'eoptions.tpm' ,
554
- desc = 'template in form of tissue probablitiy maps to normalize to' ,
575
+ desc = ('template in form of tissue probablitiy maps to '
576
+ 'normalize to' ),
555
577
xor = ['deformation_file' ],
556
578
copyfile = False )
557
579
affine_regularization_type = traits .Enum ('mni' , 'size' , 'none' ,
@@ -570,15 +592,17 @@ class Normalize12InputSpec(SPMCommandInputSpec):
570
592
write_bounding_box = traits .List (traits .List (traits .Float (),
571
593
minlen = 3 , maxlen = 3 ),
572
594
field = 'woptions.bb' , minlen = 2 , maxlen = 2 ,
573
- desc = ('3x2-element list of lists representing '
574
- 'the bounding box (in mm) to be written' ))
595
+ desc = ('3x2-element list of lists '
596
+ 'representing the bounding box '
597
+ '(in mm) to be written' ))
575
598
write_voxel_sizes = traits .List (traits .Float (), field = 'woptions.vox' ,
576
599
minlen = 3 , maxlen = 3 ,
577
600
desc = ('3-element list representing the '
578
601
'voxel sizes (in mm) of the written '
579
602
'normalised images' ))
580
603
write_interp = traits .Range (low = 0 , high = 7 , field = 'woptions.interp' ,
581
- desc = 'degree of b-spline used for interpolation' )
604
+ desc = ('degree of b-spline used for '
605
+ 'interpolation' ))
582
606
583
607
584
608
class Normalize12OutputSpec (TraitedSpec ):
0 commit comments