@@ -404,7 +404,7 @@ def _get_design_root(self, infile):
404
404
return fname .split ('.' )[0 ]
405
405
406
406
def _list_outputs (self ):
407
- #TODO: figure out file names and get rid off the globs
407
+ # TODO: figure out file names and get rid off the globs
408
408
outputs = self ._outputs ().get ()
409
409
root = self ._get_design_root (list_to_filename (self .inputs .fsf_file ))
410
410
design_file = glob (os .path .join (os .getcwd (), '%s*.mat' % root ))
@@ -430,14 +430,14 @@ def _list_outputs(self):
430
430
# ohinds: 2009-12-28
431
431
432
432
class FILMGLSInputSpec (FSLCommandInputSpec ):
433
- in_file = File (exists = True , mandatory = True , position = - 3 ,
433
+ in_file = File (exists = True , mandatory = True , position = - 3 ,
434
434
argstr = '%s' ,
435
435
desc = 'input data file' )
436
- design_file = File (exists = True , position = - 2 ,
436
+ design_file = File (exists = True , position = - 2 ,
437
437
argstr = '%s' ,
438
438
desc = 'design matrix file' )
439
439
threshold = traits .Float (1000 , min = 0 , argstr = '%f' ,
440
- position = - 1 ,
440
+ position = - 1 ,
441
441
desc = 'threshold' )
442
442
smooth_autocorr = traits .Bool (argstr = '-sa' ,
443
443
desc = 'Smooth auto corr estimates' )
@@ -549,6 +549,181 @@ def _list_outputs(self):
549
549
cwd = results_dir )
550
550
return outputs
551
551
552
+ class FSLGLMInputSpec (FSLCommandInputSpec ):
553
+ """
554
+ Use FSL GLM
555
+ @author: sebastian urchs
556
+
557
+
558
+ """
559
+
560
+ in_file = File (exists = True , argstr = '-i %s' , mandatory = True , position = 1 ,
561
+ desc = 'input file name (text matrix or 3D/4D image file)' )
562
+
563
+ output_file = File (argstr = '-o %s' , mandatory = True , position = 3 ,
564
+ desc = ('filename for GLM parameter estimates'
565
+ + ' (GLM betas)' ))
566
+
567
+ design_file = File (exists = True , argstr = '-d %s' , mandatory = True , position = 2 ,
568
+ desc = ('file name of the GLM design matrix (text time'
569
+ + ' courses for temporal regression or an image'
570
+ + ' file for spatial regression)' ))
571
+
572
+ contrasts = File (exists = True , argstr = '-c %s' , desc = ('matrix of t-statics'
573
+ + ' contrasts' ))
574
+
575
+ mask = File (exists = True , argstr = '-m %s' , desc = ('mask image file name if'
576
+ + ' input is image' ))
577
+
578
+ dof = traits .Int (argstr = '--dof %d' , desc = ('set degrees of freedom'
579
+ + ' explicitly' ))
580
+
581
+ des_norm = traits .Bool (argstr = '--des_norm' , desc = ('switch on normalization'
582
+ + ' of the design matrix'
583
+ + ' columns to unit std'
584
+ + ' deviation' ))
585
+
586
+ dat_norm = traits .Bool (argstr = '--dat_norm' , desc = ('switch on normalization'
587
+ + ' of the data time'
588
+ + ' series to unit std'
589
+ + ' deviation' ))
590
+
591
+ var_norm = traits .Bool (argstr = '--vn' , desc = ('perform MELODIC variance-'
592
+ + 'normalisation on data' ))
593
+
594
+ demean = traits .Bool (argstr = '--demean' , desc = ('switch on demeaining of '
595
+ + ' design and data' ))
596
+
597
+ out_cope = File (argstr = '--out_cope=%s' ,
598
+ desc = 'output file name for COPE (either as txt or image' )
599
+
600
+ out_z_name = File (argstr = '--out_z=%s' ,
601
+ desc = 'output file name for Z-stats (either as txt or image' )
602
+
603
+ out_t_name = File (argstr = '--out_t=%s' ,
604
+ desc = 'output file name for t-stats (either as txt or image' )
605
+
606
+ out_p_name = File (argstr = '--out_p=%s' ,
607
+ desc = ('output file name for p-values of Z-stats (either as'
608
+ + ' text file or image)' ))
609
+
610
+ out_f_name = File (argstr = '--out_f=%s' ,
611
+ desc = 'output file name for F-value of full model fit' )
612
+
613
+ out_pf_name = File (argstr = '--out_pf=%s' ,
614
+ desc = 'output file name for p-value for full model fit' )
615
+
616
+ out_res_name = File (argstr = '--out_res=%s' ,
617
+ desc = 'output file name for residuals' )
618
+
619
+ out_varcb_name = File (argstr = '--out_varcb=%s' ,
620
+ desc = 'output file name for variance of COPEs' )
621
+
622
+ out_sigsq_name = File (argstr = '--out_sigsq=%s' ,
623
+ desc = ('output file name for residual noise variance'
624
+ + ' sigma-square' ))
625
+
626
+ out_data_name = File (argstr = '--out_data=%s' ,
627
+ desc = 'output file name for pre-processed data' )
628
+
629
+ out_vnscales_name = File (argstr = '--out_vnscales=%s' ,
630
+ desc = ('output file name for scaling factors for variance'
631
+ + ' normalisation' ))
632
+
633
+
634
+ class FSLGLMOutputSpec (TraitedSpec ):
635
+ out_file = File (exists = True , desc = ('file name of GLM parameters'
636
+ + ' (if generated)' ))
637
+
638
+ out_cope = OutputMultiPath (exists = True , desc = 'output file name for COPEs' +
639
+ ' (either as text file or image)' )
640
+
641
+ out_z = OutputMultiPath (exists = True , desc = 'output file name for COPEs' +
642
+ ' (either as text file or image)' )
643
+
644
+ out_t = OutputMultiPath (exists = True , desc = 'output file name for t-stats' +
645
+ ' (either as text file or image)' )
646
+
647
+ out_p = OutputMultiPath (exists = True , desc = 'output file name for p-values' +
648
+ ' of Z-stats (either as text file or image)' )
649
+
650
+ out_f = OutputMultiPath (exists = True , desc = 'output file name for F-value' +
651
+ ' of full model fit' )
652
+
653
+ out_pf = OutputMultiPath (exists = True , desc = 'output file name for p-value' +
654
+ ' for full model fit' )
655
+
656
+ out_res = OutputMultiPath (exists = True , desc = 'output file name for' +
657
+ ' residuals' )
658
+
659
+ out_varcb = OutputMultiPath (exists = True , desc = 'output file name for' +
660
+ ' variance of COPEs' )
661
+
662
+ out_sigsq = OutputMultiPath (exists = True , desc = 'output file name for' +
663
+ ' residual noise variance sigma-square' )
664
+
665
+ out_data = OutputMultiPath (exists = True , desc = 'output file name for' +
666
+ ' residual noise variance sigma-square' )
667
+
668
+ out_vnscales = OutputMultiPath (exists = True , desc = 'output file name' +
669
+ ' for scaling factors for variance' +
670
+ ' normalisation' )
671
+
672
+
673
+ class FSLGLM (FSLCommand ):
674
+ """
675
+ Use FSL GLM.
676
+ @author: sebastian urchs
677
+
678
+ @status: testing
679
+
680
+ """
681
+ _cmd = 'fsl_glm'
682
+ input_spec = FSLGLMInputSpec
683
+ output_spec = FSLGLMOutputSpec
684
+
685
+ def _list_outputs (self ):
686
+ import os
687
+ outputs = self .output_spec ().get ()
688
+
689
+ outputs ['out_file' ] = os .path .join (os .getcwd (), self .inputs .output_file )
690
+
691
+ if isdefined (self .inputs .out_cope ):
692
+ outputs ['out_cope' ] = os .path .join (os .getcwd (), self .inputs .out_cope )
693
+
694
+ if isdefined (self .inputs .out_z_name ):
695
+ outputs ['out_z' ] = os .path .join (os .getcwd (), self .inputs .out_z_name )
696
+
697
+ if isdefined (self .inputs .out_t_name ):
698
+ outputs ['out_t' ] = os .path .join (os .getcwd (), self .inputs .out_t_name )
699
+
700
+ if isdefined (self .inputs .out_p_name ):
701
+ outputs ['out_p' ] = os .path .join (os .getcwd (), self .inputs .out_p_name )
702
+
703
+ if isdefined (self .inputs .out_f_name ):
704
+ outputs ['out_f' ] = os .path .join (os .getcwd (), self .inputs .out_f_name )
705
+
706
+ if isdefined (self .inputs .out_pf_name ):
707
+ outputs ['out_pf' ] = os .path .join (os .getcwd (), self .inputs .out_pf_name )
708
+
709
+ if isdefined (self .inputs .out_res_name ):
710
+ outputs ['out_res' ] = os .path .join (os .getcwd (), self .inputs .out_res_name )
711
+
712
+ if isdefined (self .inputs .out_varcb_name ):
713
+ outputs ['out_varcb' ] = os .path .join (os .getcwd (), self .inputs .out_varcb_name )
714
+
715
+ if isdefined (self .inputs .out_sigsq_name ):
716
+ outputs ['out_sigsq' ] = os .path .join (os .getcwd (), self .inputs .out_sigsq_name )
717
+
718
+ if isdefined (self .inputs .out_data_name ):
719
+ outputs ['out_data' ] = os .path .join (os .getcwd (), self .inputs .out_data_name )
720
+
721
+ if isdefined (self .inputs .out_vnscales_name ):
722
+ outputs ['out_vnscales' ] = os .path .join (os .getcwd (), self .inputs .out_vnscales_name )
723
+
724
+ return outputs
725
+
726
+
552
727
553
728
class FEATRegisterInputSpec (BaseInterfaceInputSpec ):
554
729
feat_dirs = InputMultiPath (Directory (), exist = True , desc = "Lower level feat dirs" ,
@@ -732,7 +907,7 @@ def _list_outputs(self):
732
907
733
908
class ContrastMgrInputSpec (FSLCommandInputSpec ):
734
909
tcon_file = File (exists = True , mandatory = True ,
735
- argstr = '%s' , position = - 1 ,
910
+ argstr = '%s' , position = - 1 ,
736
911
desc = 'contrast file containing T-contrasts' )
737
912
fcon_file = File (exists = True , argstr = '-f %s' ,
738
913
desc = 'contrast file containing F-contrasts' )
@@ -744,7 +919,7 @@ class ContrastMgrInputSpec(FSLCommandInputSpec):
744
919
desc = 'statistical corrections used within FILM modelling' )
745
920
dof_file = File (exists = True , argstr = '' , copyfile = False , mandatory = True ,
746
921
desc = 'degrees of freedom' )
747
- sigmasquareds = File (exists = True , argstr = '' , position = - 2 ,
922
+ sigmasquareds = File (exists = True , argstr = '' , position = - 2 ,
748
923
copyfile = False , mandatory = True ,
749
924
desc = 'summary of residuals, See Woolrich, et. al., 2001' )
750
925
contrast_num = traits .Int (min = 1 , argstr = '-cope' ,
@@ -905,7 +1080,7 @@ def _run_interface(self, runtime):
905
1080
'/NumContrasts 1' ,
906
1081
'/PPheights %e' % 1 ,
907
1082
'/RequiredEffect 100.0' , # XX where does this
908
- #number come from
1083
+ # number come from
909
1084
'' ,
910
1085
'/Matrix' ,
911
1086
'%e' % 1 ]
@@ -1121,7 +1296,7 @@ class SMM(FSLCommand):
1121
1296
1122
1297
def _list_outputs (self ):
1123
1298
outputs = self ._outputs ().get ()
1124
- #TODO get the true logdir from the stdout
1299
+ # TODO get the true logdir from the stdout
1125
1300
outputs ['null_p_map' ] = self ._gen_fname (basename = "w1_mean" , cwd = "logdir" )
1126
1301
outputs ['activation_p_map' ] = self ._gen_fname (basename = "w2_mean" , cwd = "logdir" )
1127
1302
if not isdefined (self .inputs .no_deactivation_class ) or not self .inputs .no_deactivation_class :
@@ -1382,7 +1557,7 @@ def _list_outputs(self):
1382
1557
if inval :
1383
1558
change_ext = True
1384
1559
if suffix .endswith ('.txt' ):
1385
- change_ext = False
1560
+ change_ext = False
1386
1561
outputs [outkey ] = self ._gen_fname (self .inputs .in_file ,
1387
1562
suffix = '_' + suffix ,
1388
1563
change_ext = change_ext )
0 commit comments