Skip to content

Commit f1ccf99

Browse files
committed
a new path to solve issue nipy#1087
1 parent 82107dd commit f1ccf99

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

nipype/interfaces/dcmstack.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ class NiftiGeneratorBaseInputSpec(TraitedSpec):
4848
"meta data to create the output filename(s)")
4949
out_ext = traits.Str('.nii.gz', usedefault=True,
5050
desc="Determines output file type")
51-
use_cwd = traits.Bool(True, usedefault=True,
52-
desc='use interface\'s current working directory')
51+
out_path = Directory(desc='output path, current working directory if not set')
5352

5453

5554
class NiftiGeneratorBase(BaseInterface):
@@ -77,10 +76,11 @@ def _get_out_path(self, meta, idx=None):
7776
out_fn = (out_fmt % meta) + self.inputs.out_ext
7877
out_fn = sanitize_path_comp(out_fn)
7978

80-
if self.inputs.use_cwd:
81-
return path.join(os.getcwd(), out_fn)
82-
else:
83-
return path.abspath(out_fn)
79+
out_path = os.getcwd()
80+
if isdefined(self.inputs.out_path):
81+
out_path = path.abspath(self.inputs.out_path)
82+
return path.join(out_path, out_fn)
83+
8484

8585

8686
class DcmStackInputSpec(NiftiGeneratorBaseInputSpec):

0 commit comments

Comments
 (0)