@@ -668,12 +668,17 @@ def _list_outputs(self):
668
668
669
669
class MemaInputSpec (AFNICommandInputSpec ):
670
670
# mandatory inputs
671
- subject_trait = traits .Tuple (
672
- Str , File (exists = True ), File (exists = True ), Str ('' ), Str ('' )
671
+ _subject_trait = traits .Either (
672
+ traits .Tuple (
673
+ Str (minlen = 1 ), File (exists = True ), File (exists = True )
674
+ ),
675
+ traits .Tuple (
676
+ Str (minlen = 1 ), File (exists = True ), File (exists = True ), Str ('' ), Str ('' )
677
+ )
673
678
)
674
679
675
680
sets = traits .List (
676
- traits .Tuple (Str (minlen = 1 ), traits .List (subject_trait , minlen = 2 )),
681
+ traits .Tuple (Str (minlen = 1 ), traits .List (_subject_trait , minlen = 2 )),
677
682
desc = """\
678
683
Specify the data for one of two test variables (either group, contrast/GLTs) A & B.
679
684
@@ -695,7 +700,7 @@ class MemaInputSpec(AFNICommandInputSpec):
695
700
e.g: -set Placebo Jane pb05.Jane.Regression+tlrc'[face#0_Beta]'
696
701
pb05.Jane.Regression+tlrc'[face#0_Tstat]'
697
702
""" ,
698
- argstr = '-set %s ...' ,
703
+ argstr = '-set %s...' ,
699
704
mandatory = True ,
700
705
minlen = 1 ,
701
706
maxlen = 2 ,
@@ -814,7 +819,7 @@ class MemaInputSpec(AFNICommandInputSpec):
814
819
argstr = '-mask %s'
815
820
)
816
821
817
- max_zeros = traits .Range ( # Please revise all the other possible settings
822
+ max_zeros = traits .Range ( # Please revise all the other possible settings\
818
823
desc = """\
819
824
Do not compute statistics at any voxel that has \
820
825
more than MM zero beta coefficients or GLTs. Voxels around \
@@ -829,8 +834,7 @@ class MemaInputSpec(AFNICommandInputSpec):
829
834
less than the number of subjects, or a fraction \
830
835
between 0 and 1. Alternatively option -missing_data \
831
836
can be used to handle missing data.""" ,
832
-
833
- min = 0.0 , max = 1.0 ,
837
+ low = 0.0 , high = 1.0 ,
834
838
argstr = '-max_zeros %f' ,
835
839
xor = ['missing_data' ],
836
840
)
@@ -899,11 +903,12 @@ class MemaInputSpec(AFNICommandInputSpec):
899
903
argstr = '-rio' )
900
904
901
905
verbosity = traits .Range (
902
- 1 ,
906
+ value = 1 ,
903
907
usedefault = True ,
904
- min = 0 ,
908
+ low = 0 ,
905
909
desc = 'An integer specifying verbosity level. 0 is quiet, 1+ is talkative.' ,
906
- argstr = '-verb %d' )
910
+ argstr = '-verb %d'
911
+ )
907
912
908
913
909
914
class MemaOutputSpec (AFNICommandOutputSpec ):
@@ -919,7 +924,7 @@ class Mema(AFNICommand):
919
924
"""Description of 3dMEMA
920
925
921
926
For complete details, see the `3dMEMA Documentation.
922
- <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dMEMA.html>
927
+ <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dMEMA.html>`__
923
928
924
929
Examples
925
930
========
@@ -935,6 +940,28 @@ class Mema(AFNICommand):
935
940
input_spec = MemaInputSpec
936
941
output_spec = MemaOutputSpec
937
942
943
+ def _format_arg (self , name , trait_spec , value ):
944
+ if name == "sets" :
945
+ self ._n_sets = len (value )
946
+ formatted_values = []
947
+ for setname , setopts in value :
948
+ formatted_subject = []
949
+ for this_set in setopts :
950
+ if len (this_set ) == 4 :
951
+ subid , beta_file , ttst_file , beta_opts , ttst_opts = this_set
952
+ if beta_opts :
953
+ beta_file = "%s'%s'" % (beta_file , beta_opts )
954
+ if ttst_opts :
955
+ ttst_file = "%s'%s'" % (ttst_file , ttst_opts )
956
+ else :
957
+ subid , beta_file , ttst_file = this_set
958
+ formatted_subject .append (' ' .join ((subid , beta_file , ttst_file )))
959
+ formatted_values .append (' ' .join ([setname ] + formatted_subject ))
960
+ value = formatted_values
961
+
962
+ return super (Mema , self )._format_arg (name , trait_spec , value )
963
+
964
+
938
965
def _parse_inputs (self , skip = None ):
939
966
if skip is None :
940
967
skip = []
0 commit comments