@@ -549,27 +549,30 @@ class FLIRT(FSLCommand):
549
549
_cmd = 'flirt'
550
550
input_spec = FLIRTInputSpec
551
551
output_spec = FLIRTOutputSpec
552
+ _log_written = False
552
553
553
554
def aggregate_outputs (self , runtime = None , needed_outputs = None ):
554
555
outputs = super (FLIRT , self ).aggregate_outputs (
555
556
runtime = runtime , needed_outputs = needed_outputs )
556
- if isdefined ( self .inputs .save_log ) and self .inputs . save_log :
557
+ if self .inputs .save_log and not self ._log_written :
557
558
with open (outputs .out_log , "a" ) as text_file :
558
559
text_file .write (runtime .stdout + '\n ' )
560
+ self ._log_written = True
559
561
return outputs
560
562
561
563
def _parse_inputs (self , skip = None ):
562
- skip = []
563
- if isdefined ( self . inputs . save_log ) and self . inputs . save_log :
564
- if not isdefined ( self .inputs .verbose ) or self .inputs .verbose == 0 :
565
- self .inputs .verbose = 1
566
- if isdefined ( self .inputs .apply_xfm ) and self .inputs .apply_xfm :
567
- if not self . inputs . in_matrix_file and not self .inputs .uses_qform :
568
- raise RuntimeError ('Argument apply_xfm requires in_matrix_file '
569
- 'or uses_qform arguments to run' )
564
+ if skip is None :
565
+ skip = []
566
+ if self .inputs .save_log and not self .inputs .verbose :
567
+ self .inputs .verbose = 1
568
+ if self .inputs .apply_xfm and not ( self .inputs .in_matrix_file or
569
+ self .inputs .uses_qform ) :
570
+ raise RuntimeError ('Argument apply_xfm requires in_matrix_file or '
571
+ ' uses_qform arguments to run' )
570
572
skip .append ('save_log' )
571
573
return super (FLIRT , self )._parse_inputs (skip = skip )
572
574
575
+
573
576
class ApplyXFMInputSpec (FLIRTInputSpec ):
574
577
apply_xfm = traits .Bool (
575
578
True , argstr = '-applyxfm' ,
0 commit comments