17
17
File ,
18
18
Directory ,
19
19
traits ,
20
- OutputMultiPath
20
+ OutputMultiPath ,
21
+ isdefined
21
22
)
22
23
import os
23
24
@@ -31,7 +32,7 @@ class ICA_AROMAInputSpec(CommandLineInputSpec):
31
32
in_file = File (exists = True , mandatory = True ,
32
33
argstr = '-i %s' , xor = ['feat_dir' ],
33
34
desc = 'volume to be denoised' )
34
- out_dir = Directory ('out' , mandatory = True ,
35
+ out_dir = Directory ('out' , genfile = True ,
35
36
argstr = '-o %s' ,
36
37
desc = 'output directory' )
37
38
mask = File (exists = True , argstr = '-m %s' , xor = ['feat_dir' ],
@@ -108,6 +109,10 @@ class ICA_AROMA(CommandLine):
108
109
109
110
def _list_outputs (self ):
110
111
outputs = self .output_spec ().get ()
112
+ if isdefined (self .inputs .out_dir ):
113
+ outputs ['out_dir' ] = os .path .abspath (self .inputs .out_dir )
114
+ else :
115
+ outputs ['out_dir' ] = self ._gen_filename ("out_dir" )
111
116
out_dir = os .path .abspath (self .inputs .out_dir )
112
117
outputs ['out_dir' ] = out_dir
113
118
@@ -116,4 +121,8 @@ def _list_outputs(self):
116
121
if self .inputs .denoise_type in ('nonaggr' , 'both' ):
117
122
outputs ['nonaggr_denoised_file' ] = os .path .join (out_dir , 'denoised_func_data_nonaggr.nii.gz' )
118
123
124
+ def _gen_filename (self , name ):
125
+ if name == "out_dir" :
126
+ return os .getcwd ()
127
+
119
128
return outputs
0 commit comments