12
12
import os
13
13
from .base import AFNIBaseCommandInputSpec , AFNIBaseCommand
14
14
from ..base import (Directory , CommandLineInputSpec , CommandLine , TraitedSpec ,
15
- traits , isdefined , File , InputMultiPath )
15
+ traits , isdefined , File , InputMultiPath , Undefined )
16
16
from ...utils .filemanip import (load_json , save_json , split_filename )
17
17
from nipype .utils .filemanip import fname_presuffix
18
18
from nipype .interfaces .afni .base import AFNICommand , AFNICommandInputSpec ,\
@@ -280,7 +280,7 @@ class ResampleInputSpec(AFNICommandInputSpec):
280
280
argstr = '-orient %s' )
281
281
282
282
283
- class Resample (AFNIBaseCommand ):
283
+ class Resample (AFNICommand ):
284
284
"""Resample or reorient an image using AFNI 3dresample command
285
285
286
286
For complete details, see the `3dresample Documentation.
@@ -534,7 +534,7 @@ def _gen_filename(self, name):
534
534
535
535
_ , base , _ = split_filename (
536
536
getattr (self .inputs , trait_spec .name_source ))
537
- return self ._gen_fname (basename = base , prefix = prefix , suffix = suffix , cwd = '' )
537
+ return self ._gen_fname (basename = base , prefix = prefix , suffix = suffix , cwd = os . getcwd () )
538
538
elif name == "brain_file" and isdefined (self .inputs .apply_suffix ):
539
539
suffix = ''
540
540
prefix = ''
@@ -543,7 +543,7 @@ def _gen_filename(self, name):
543
543
544
544
_ , base , _ = split_filename (
545
545
getattr (self .inputs , trait_spec .name_source ))
546
- return self ._gen_fname (basename = base , prefix = prefix , suffix = suffix , cwd = '' )
546
+ return self ._gen_fname (basename = base , prefix = prefix , suffix = suffix , cwd = os . getcwd () )
547
547
elif name == "apply_mask" and isdefined (self .inputs .apply_suffix ):
548
548
suffix = ''
549
549
prefix = ''
@@ -552,9 +552,10 @@ def _gen_filename(self, name):
552
552
553
553
_ , base , _ = split_filename (
554
554
getattr (self .inputs , trait_spec .name_source ))
555
- return self ._gen_fname (basename = base , prefix = prefix , suffix = suffix , cwd = '' )
556
- else :
557
- return super (AFNICommand , self )._gen_filename (name )
555
+ return self ._gen_fname (basename = base , prefix = prefix , suffix = suffix , cwd = os .getcwd ())
556
+ elif hasattr (self .inputs ,name ) and isdefined (getattr (self .inputs ,name )):
557
+ return super (Automask , self )._gen_filename (name )
558
+ return Undefined
558
559
559
560
def _list_outputs (self ):
560
561
outputs = super (Automask , self )._list_outputs ()
0 commit comments